简体   繁体   English

使用Pandoc的相对独立的Reveal.js文件夹的独立的Reveal.js文件

[英]Self-Contained reveal.js file without relative reveal.js folder using Pandoc

I am having trouble producing a self-contained reveal.js slideshow with Pandoc when the reveal.js folder is not relative to the markdown file. 当Reveal.js文件夹与markdown文件无关时,我无法使用Pandoc制作独立的Reveal.js幻灯片。

A simple Markdown file, Tester.md: 一个简单的Markdown文件Tester.md:

# Title Slide

# Second Slide
More stuff happening here

# Some more stuff
Hello

The reveal.js folder is located at "c:/Users/Jared/Documents/reveal.js". manifest.js文件夹位于“ c:/Users/Jared/Documents/reveal.js”。

Running 运行

pandoc -s -S -t revealjs Tester.md -o TesterReveal.html -V revealjs-url:c:/Users/Jared/Documents/reveal.js

creates an HTML file that links to the appropriate reveal.js folder and everything works just fine. 创建一个HTML文件,该文件链接到相应的reveal.js文件夹,并且一切正常。

However, if I set --self-contained Pandoc returns an error. 但是,如果我设置--self-contained Pandoc将返回错误。

pandoc -s -S -t revealjs Tester.md -o TesterReveal.html -V revealjs-url:c:/Users/Jared/Documents/reveal.js --self-contained

pandoc.exe: Failed to retrieve c:/Users/Jared/Documents/reveal.js/css/reveal.min.css
InvalidUrlException "c:/Users/Jared/Documents/reveal.js/css/reveal.min.css" "Invalid scheme"

Setting --self-contained works fine if the reveal.js folder is relative to Tester.md. 如果reveal.js文件夹相对于Tester.md,则设置--self-contained可以正常工作。

So I imagine the combination of --self-contained and -V revealjs-url:c:/Users/Jared/Documents/reveal.js is the culprit. 因此,我-V revealjs-url:c:/Users/Jared/Documents/reveal.js罪魁祸首是--self-contained-V revealjs-url:c:/Users/Jared/Documents/reveal.js的结合。

Any ideas how to keep the reveal.js folder in its own place and still have --self-contained work properly. 任何关于如何将reveal.js文件夹保留在自己的位置并且仍然具有--self-contained I feel that copying the reveal.js folder into every presentation I do is not a good practice. 我觉得将reveal.js文件夹复制到我做的每个演示文稿中都不是一个好习惯。

Sorry for the necromancy, but I was experiencing similar problems. 对不起,请您提前告知我,但我遇到了类似的问题。 I solved it by finding out my pandoc user data directory: 我通过找到我的pandoc用户数据目录来解决它:

pandoc --version

downloading the latest reveal.js , unzipping it into the user data directory, and renaming it to reveal.js (without the trailing version string). 下载最新的reveal.js ,将其解压缩到用户数据目录中,然后将其重命名为reveal.js(不包含尾随版本字符串)。
Now I can create self-contained slideshows from any working directory without passing url parameters. 现在,我可以从任何工作目录创建独立的幻灯片,而无需传递url参数。 This works for other formats that need scripts and stylesheets as well. 这也适用于需要脚本和样式表的其他格式。

Not thrilled with this solution but it works. 对此解决方案不感到兴奋,但它可以工作。 For each presentation I create a symbolic link (using Windows) inside that folder to the reveal.js folder that sits elsewhere on my computer. 对于每个演示,我都会在该文件夹内创建一个符号链接(使用Windows),该链接指向计算机上其他位置的Reveal.js文件夹。

mklink /D reveal.js C:\Users\Jared\Documents\reveal.js

Gets the job done and makes pandoc happy. 完成工作并使Pandoc感到高兴。

I was having a similar problem using --self-contained to embed a css file within html output. 使用--self-contained将css文件嵌入html输出中时,我遇到了类似的问题。 On a whim I tried using \\\\ as the path delimiter instead of / and it worked! 一时兴起,我尝试使用\\\\代替/来作为路径定界符,并且成功了! You might try: 您可以尝试:

pandoc -s -S -t revealjs Tester.md -o TesterReveal.html -V revealjs-url:c:\\Users\\Jared\\Documents\\reveal.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM