光明酸奶 發表於 2023-5-30 00:00:00

使用Landslide基于MarkDown制作在线Slide

<h2 id="wow0">Landsilde工具使用</h2><p>Landslide是基于Google的<code>html5slides</code>的一个Slide生成工具,可将markdown、ReST 或者 textile文件转化成HTML5的slide。</p><p>该转化支持内联模式,即生成一个具有完整功能的HTML文件,将依赖的css等东西放入其中,很容易用来分享。</p><p>类似的还有工具还有 remark,相关gitlab项目主页:</p><ul class=" list-paddingleft-2"><li>https://github.com/adamzap/landslide</li><li>https://github.com/gnab/remark/</li></ul><h3 id="wow1">安装landslide</h3><p>方案一 pip安装:</p><pre class="brush:bash;toolbar:false">$&nbsp;pip&nbsp;install&nbsp;landslide</pre><p>方案二 源码安装:</p><pre class="brush:bash;toolbar:false">$&nbsp;git&nbsp;clone&nbsp;https://github.com/adamzap/landslide.git
$&nbsp;cd&nbsp;landslide
$&nbsp;python&nbsp;setup.py&nbsp;build
$&nbsp;sudo&nbsp;python&nbsp;setup.py&nbsp;install</pre><p><br/></p><h3 id="wow2">Markdown书写Slide内容</h3><p>以markdown语法书写,可以参考landslide提供的示例:</p><ul class=" list-paddingleft-2"><li>https://github.com/adamzap/landslide/blob/master/examples/markdown/slides.md</li></ul><h3 id="wow3">生成PPT页面</h3><p>以官方提供的markdown文本为例,文件命名为test.md,完成后执行如下命令生成HTML内容:</p><figure class="code"><figcaption></figcaption><div class="highlight"><pre class="brush:bash;toolbar:false">$&nbsp;landslide&nbsp;file.md&nbsp;-i&nbsp;-o&nbsp;&gt;&nbsp;test.html</pre></div></figure><p>命令行参数说明详见下文介绍。</p><p>可以直接在浏览器中打开观察效果:</p><figure class="code"><figcaption></figcaption><div class="highlight"><pre class="brush:bash;toolbar:false">open&nbsp;test.html</pre></div></figure><p>支持快捷键,可左右切换slide,详见下文快捷键介绍。</p><p><img style="max-width:100%!important;height:auto!important;" src="https://zhuji.jb51.net/uploads/img/20230517/b415b018c69a2bcc1bd099e1b29ce0e4.jpg" width="962" height="744"/></p><h2 id="wow4">使用PrinceXML生成PDF</h2><p>PrinceXML是一款将html转换为pdf的工具,提供免费带水印版试用。</p><p>下载地址:</p><ul class=" list-paddingleft-2"><li>http://www.princexml.com/download/</li></ul><p>选择对应版本解压后执行脚本安装:</p><figure class="code"><figcaption></figcaption><div class="highlight"><pre class="brush:bash;toolbar:false">$&nbsp;sh&nbsp;insatll.sh</pre></div></figure><p>指定路径安装完毕后即可使用prince命令。</p><figure class="code"><figcaption></figcaption><div class="highlight"><pre class="brush:bash;toolbar:false">$&nbsp;prince&nbsp;test.html&nbsp;-o&nbsp;test.pdf</pre></div></figure><p>即可生成需要的PDF PPT文件。</p><h2 id="wow5">Landslide快捷键及命令参数介绍</h2><h3 id="wow6">PPT页面快捷键</h3><p>快捷键如下:</p><blockquote><p>Press h to toggle display of help</p><p>Press left arrow and right arrow to navigate</p><p>Press t to toggle a table of contents for your presentation. Slide titles are links</p><p>Press ESC to display the presentation overview (Exposé)</p><p>Press n to toggle slide number visibility</p><p>Press b to toggle screen blanking</p><p>Press c to toggle current slide context (previous and next slides)</p><p>Press e to make slides filling the whole available space within the document body</p><p>Press S to toggle display of link to the source file for each slide</p><p>Press ‘2’ to toggle notes in your slides (specify with the .notes macro)</p><p>Press ‘3’ to toggle pseudo-3D display (experimental)</p><p>Browser zooming is supported</p></blockquote><h3 id="wow7">命令行参数介绍</h3><p>landslide命令行参数介绍如下:</p><figure class="code"><figcaption></figcaption><div class="highlight"><pre class="brush:bash;toolbar:false">-h,&nbsp;--help&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;show&nbsp;this&nbsp;help&nbsp;message&nbsp;and&nbsp;exit
-c,&nbsp;--copy-theme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copy&nbsp;theme&nbsp;directory&nbsp;into&nbsp;current&nbsp;presentation&nbsp;source&nbsp;directory
-b,&nbsp;--debug&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Will&nbsp;display&nbsp;any&nbsp;exception&nbsp;trace&nbsp;to&nbsp;stdin
-d&nbsp;FILE,&nbsp;--destination=FILE
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;path&nbsp;to&nbsp;the&nbsp;to&nbsp;the&nbsp;destination&nbsp;file:&nbsp;.html&nbsp;or&nbsp;.pdf
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;extensions&nbsp;allowed&nbsp;(default:&nbsp;presentation.html)
-e&nbsp;ENCODING,&nbsp;--encoding=ENCODING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;encoding&nbsp;of&nbsp;your&nbsp;files&nbsp;(defaults&nbsp;to&nbsp;utf8)
-i,&nbsp;--embed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Embed&nbsp;stylesheet&nbsp;and&nbsp;javascript&nbsp;contents,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base64-encoded&nbsp;images&nbsp;in&nbsp;presentation&nbsp;to&nbsp;make&nbsp;a
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;standalone&nbsp;document
-l&nbsp;LINENOS,&nbsp;--linenos=LINENOS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;How&nbsp;to&nbsp;output&nbsp;linenos&nbsp;in&nbsp;source&nbsp;code.&nbsp;Three&nbsp;options
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;availables:&nbsp;no&nbsp;(no&nbsp;line&nbsp;numbers);&nbsp;inline&nbsp;inside&nbsp;pre&nbsp;tag
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table&nbsp;(lines&nbsp;numbers&nbsp;in&nbsp;another&nbsp;cell,&nbsp;copy-paste&nbsp;friendly)
-o,&nbsp;--direct-output&nbsp;&nbsp;&nbsp;Prints&nbsp;the&nbsp;generated&nbsp;HTML&nbsp;code&nbsp;to&nbsp;stdin;&nbsp;won&#39;t&nbsp;work&nbsp;with&nbsp;PDF&nbsp;export
-q,&nbsp;--quiet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Won&#39;t&nbsp;write&nbsp;anything&nbsp;to&nbsp;stdin&nbsp;(silent&nbsp;mode)
-r,&nbsp;--relative&nbsp;&nbsp;&nbsp;Make&nbsp;your&nbsp;presentation&nbsp;asset&nbsp;links&nbsp;relative&nbsp;to&nbsp;current
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pwd;&nbsp;This&nbsp;may&nbsp;be&nbsp;useful&nbsp;if&nbsp;you&nbsp;intend&nbsp;to&nbsp;publish&nbsp;your
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;html&nbsp;presentation&nbsp;online.
-t&nbsp;THEME,&nbsp;--theme=THEME
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;theme&nbsp;name,&nbsp;or&nbsp;path&nbsp;to&nbsp;a&nbsp;landlside&nbsp;theme&nbsp;directory
-v,&nbsp;--verbose&nbsp;&nbsp;Write&nbsp;informational&nbsp;messages&nbsp;to&nbsp;stdin&nbsp;(enabled&nbsp;by&nbsp;default)
-w,&nbsp;--watch&nbsp;&nbsp;&nbsp;&nbsp;Watch&nbsp;the&nbsp;source&nbsp;directory&nbsp;for&nbsp;changes&nbsp;and&nbsp;auto-regenerate&nbsp;the&nbsp;presentation
-x&nbsp;EXTENSIONS,&nbsp;--extensions=EXTENSIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Comma-separated&nbsp;list&nbsp;of&nbsp;extensions&nbsp;for&nbsp;Markdown
-m,&nbsp;--math-output&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Enable&nbsp;mathematical&nbsp;output&nbsp;using&nbsp;mathjax</pre></div></figure>
頁: [1]
查看完整版本: 使用Landslide基于MarkDown制作在线Slide