用python绘制slide_使用Landslide基于MarkDown制作在线Slide

Landsilde工具使用

Landslide是基于Google的html5slides的一个Slide生成工具,可将markdown、ReST 或者 textile文件转化成HTML5的slide。

该转化支持内联模式,即生成一个具有完整功能的HTML文件,将依赖的css等东西放入其中,很容易用来分享。

类似的还有工具还有 remark,相关gitlab项目主页:

安装landslide

方案一 pip安装:

$ pip install landslide

1

2

$pipinstalllandslide

方案二 源码安装:

$ git clone https://github.com/adamzap/landslide.git

$ cd landslide

$ python setup.py build

$ sudo python setup.py install

1

2

3

4

5

$gitclonehttps://github.com/adamzap/landslide.git

$cdlandslide

$pythonsetup.pybuild

$sudopythonsetup.pyinstall

Markdown书写Slide内容

以markdown语法书写,可以参考landslide提供的示例:

生成PPT页面

以官方提供的markdown文本为例,文件命名为test.md,完成后执行如下命令生成HTML内容:

$ landslide file.md -i -o > test.html

1

$landslidefile.md-i-o>test.html

命令行参数说明详见下文介绍。

可以直接在浏览器中打开观察效果:

open test.html

1

opentest.html

支持快捷键,可左右切换slide,详见下文快捷键介绍。

使用PrinceXML生成PDF

PrinceXML是一款将html转换为pdf的工具,提供免费带水印版试用。

下载地址:

选择对应版本解压后执行脚本安装:

$ sh insatll.sh

1

$shinsatll.sh

指定路径安装完毕后即可使用prince命令。

$ prince test.html -o test.pdf

1

$princetest.html-otest.pdf

即可生成需要的PDF PPT文件。

Landslide快捷键及命令参数介绍

PPT页面快捷键

快捷键如下:

Press h to toggle display of help

Press left arrow and right arrow to navigate

Press t to toggle a table of contents for your presentation. Slide titles are links

Press ESC to display the presentation overview (Exposé)

Press n to toggle slide number visibility

Press b to toggle screen blanking

Press c to toggle current slide context (previous and next slides)

Press e to make slides filling the whole available space within the document body

Press S to toggle display of link to the source file for each slide

Press ‘2’ to toggle notes in your slides (specify with the .notes macro)

Press ‘3’ to toggle pseudo-3D display (experimental)

Browser zooming is supported

命令行参数介绍

landslide命令行参数介绍如下:

-h, --help show this help message and exit

-c, --copy-theme Copy theme directory into current presentation source directory

-b, --debug Will display any exception trace to stdin

-d FILE, --destination=FILE

The path to the to the destination file: .html or .pdf

extensions allowed (default: presentation.html)

-e ENCODING, --encoding=ENCODING

The encoding of your files (defaults to utf8)

-i, --embed Embed stylesheet and javascript contents,

base64-encoded images in presentation to make a

standalone document

-l LINENOS, --linenos=LINENOS

How to output linenos in source code. Three options

availables: no (no line numbers); inline inside pre tag

table (lines numbers in another cell, copy-paste friendly)

-o, --direct-output Prints the generated HTML code to stdin; won't work with PDF export

-q, --quiet Won't write anything to stdin (silent mode)

-r, --relative Make your presentation asset links relative to current

pwd; This may be useful if you intend to publish your

html presentation online.

-t THEME, --theme=THEME

A theme name, or path to a landlside theme directory

-v, --verbose Write informational messages to stdin (enabled by default)

-w, --watch Watch the source directory for changes and auto-regenerate the presentation

-x EXTENSIONS, --extensions=EXTENSIONS

Comma-separated list of extensions for Markdown

-m, --math-output Enable mathematical output using mathjax

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

-h,--helpshowthishelpmessageandexit

-c,--copy-themeCopythemedirectoryintocurrentpresentationsourcedirectory

-b,--debugWilldisplayanyexceptiontracetostdin

-dFILE,--destination=FILE

Thepathtothetothedestinationfile:.htmlor.pdf

extensionsallowed(default:presentation.html)

-eENCODING,--encoding=ENCODING

Theencodingofyourfiles(defaultstoutf8)

-i,--embedEmbedstylesheetandjavascriptcontents,

base64-encodedimagesinpresentationtomakea

standalonedocument

-lLINENOS,--linenos=LINENOS

Howtooutputlinenosinsourcecode.Threeoptions

availables:no(nolinenumbers);inlineinsidepretag

table(linesnumbersinanothercell,copy-pastefriendly)

-o,--direct-outputPrintsthegeneratedHTMLcodetostdin;won't work with PDF export

-q, --quiet           Won'twriteanythingtostdin(silentmode)

-r,--relativeMakeyourpresentationassetlinksrelativetocurrent

pwd;Thismaybeusefulifyouintendtopublishyour

htmlpresentationonline.

-tTHEME,--theme=THEME

Athemename,orpathtoalandlsidethemedirectory

-v,--verboseWriteinformationalmessagestostdin(enabledbydefault)

-w,--watchWatchthesourcedirectoryforchangesandauto-regeneratethepresentation

-xEXTENSIONS,--extensions=EXTENSIONS

Comma-separatedlistofextensionsforMarkdown

-m,--math-outputEnablemathematicaloutputusingmathjax

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值