基于轻量级标记语言的HTML5幻灯片生成器。从滑坡中分叉。
darkslide的Python项目详细描述
概述
基于轻量级标记语言的HTML5幻灯片生成器。从滑坡中分叉。
演示:http://ionelmc.github.io/python-darkslide/" rel="nofollow">http://ionelmc.github.io/python darkslide/
概述
slidembly使用from markdown、rest或textile生成幻灯片。 它建立在谷歌的 html5slides 模板。
下面的降价会产生 幻灯片放映
# Landslide --- # Overview Generate HTML5 slideshows from markdown, ReST, or textile. ![python](http://i.imgur.com/bc2xk.png) Landslide is primarily written in Python, but it's themes use: - HTML5 - Javascript - CSS --- # Code Sample Landslide supports code snippets !python def log(self, message, level='notice'): if self.logger and not callable(self.logger): raise ValueError(u"Invalid logger set, must be a callable") if self.verbose and self.logger: self.logger(message, level)
安装
用python包安装slide的最新稳定版本 经理喜欢的 pip :
$ pip install landslide
如果您想保持在边缘:
$ git clone https://github.com/adamzap/landslide.git $ cd landslide $ python setup.py build $ sudo python setup.py install
格式化
降价
-
标记源文件的后缀必须是
.md
,
.markdn
,
.mdwn
,
.mdown
或
.markdown
-
要创建标题幻灯片,请呈现单个
h1
元素(例如
"我的头衔"
)
-
用水平尺分隔幻灯片(降价时为
--
)
MD文件末尾除外
-
其他幻灯片的标题应呈现为
h1
元素
-
要突出显示代码块,请放置
!lang
其中lang是
pygment支持的语言标识符作为第一个缩进行
重新构造文本
- rest源文件的后缀必须是 .rst 或 .rest ( ``.txt``不受支持 )
- 对幻灯片标题使用标题
- 使用水平规则分隔幻灯片(RST中的 ---- ) 除了在rst文件的末尾之外
纺织品
-
使用
--
分隔幻灯片,就像降价一样
渲染
- 运行 滑坡滑坡。md 或 滑坡。rst
- 享受新生成的演示文稿.html
如果princexml安装在 您的系统:
$ darkslide README.md -d readme.pdf $ open readme.pdf
查看
- 按 h 切换帮助显示
- 按左箭头和右箭头导航
-
按
t 切换演示文稿的目录。 幻灯片标题是链接 - 按Esc键显示演示文稿概述(exposé)
- 按 n 切换幻灯片编号可见性
- 按 b 切换屏幕空白
- 按 c 切换当前幻灯片上下文(上一页和下一页 幻灯片)
- 按 e 使幻灯片填满 文档正文
- 按 s 切换链接到每个源文件的显示 幻灯片
- 新闻界2'切换幻灯片中的注释(用.notes指定 宏)
- 按"3"切换伪三维显示(实验性)
- 支持浏览器缩放
命令行选项
使用命令行可以使用几个选项:
-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
演示配置
slidembly允许使用 cfg 配置文件,从而简化源代码的聚合 目录和它们在演示文稿中的重用。山崩 配置文件使用 cfg 语法。如果您知道 ini 文件, 你拍到照片了。下面是一个示例配置文件:
[landslide] theme = /path/to/my/beautiful/theme source = 0_my_first_slides.md a_directory another_directory now_a_slide.markdown another_one.rst destination = myWonderfulPresentation.html css = my_first_stylesheet.css my_other_stylesheet.css js = jquery.js my_fancy_javascript.js relative = True linenos = inline
别忘了声明
要按配置生成演示文稿,只需运行:
$ cd /path/to/my/presentation/sources $ darkslide config.cfg
宏
您可以使用宏增强演示文稿:
注释
使用 将注释添加到幻灯片中。注释: 关键字,例如:
# My Slide Title .notes: These are my notes, hidden by default My visible content goes here
您可以按 2 键切换音符的显示。
默认情况下,还可以使用其他一些宏: .fx:foo bar 将 将 foo 和 bar 类添加到相应的幻灯片 <;div>; 元素,使用css简化演示文稿的样式。
二维码
使用 .qr 关键字在演示文稿中添加二维码:
.qr: http://github.com/adamzap/landslide
脚注
在当前演示文稿和以下所有演示文稿中添加脚注
# Landslide --- # Overview Generate HTML5 slideshows from markdown, ReST, or textile. ![python](http://i.imgur.com/bc2xk.png) Landslide is primarily written in Python, but it's themes use: - HTML5 - Javascript - CSS --- # Code Sample Landslide supports code snippets !python def log(self, message, level='notice'): if self.logger and not callable(self.logger): raise ValueError(u"Invalid logger set, must be a callable") if self.verbose and self.logger: self.logger(message, level)0
演示者备注
您还可以通过跟踪幻灯片向每张幻灯片添加演示者备注 标题为"演示者备注"的内容。按"P"键 打开演示者视图。
注册宏
宏用于转换幻灯片的HTML内容。
您可以通过创建slide.macro.macro来注册自己的宏。 派生类,实现 进程(content,source=none) 方法 返回一个包含修改后的内容和一些css的元组 您可能想要添加到幻灯片元素中的类。为了 例子:
# Landslide --- # Overview Generate HTML5 slideshows from markdown, ReST, or textile. ![python](http://i.imgur.com/bc2xk.png) Landslide is primarily written in Python, but it's themes use: - HTML5 - Javascript - CSS --- # Code Sample Landslide supports code snippets !python def log(self, message, level='notice'): if self.logger and not callable(self.logger): raise ValueError(u"Invalid logger set, must be a callable") if self.verbose and self.logger: self.logger(message, level)1
这将按如下方式渲染任何幻灯片:
# Landslide --- # Overview Generate HTML5 slideshows from markdown, ReST, or textile. ![python](http://i.imgur.com/bc2xk.png) Landslide is primarily written in Python, but it's themes use: - HTML5 - Javascript - CSS --- # Code Sample Landslide supports code snippets !python def log(self, message, level='notice'): if self.logger and not callable(self.logger): raise ValueError(u"Invalid logger set, must be a callable") if self.verbose and self.logger: self.logger(message, level)2
高级用法
设置自定义目标文件
# Landslide
---
# Overview
Generate HTML5 slideshows from markdown, ReST, or textile.
![python](http://i.imgur.com/bc2xk.png)
Landslide is primarily written in Python, but it's themes use:
- HTML5
- Javascript
- CSS
---
# Code Sample
Landslide supports code snippets
!python
def log(self, message, level='notice'):
if self.logger and not callable(self.logger):
raise ValueError(u"Invalid logger set, must be a callable")
if self.verbose and self.logger:
self.logger(message, level)
3
使用目录
# Landslide
---
# Overview
Generate HTML5 slideshows from markdown, ReST, or textile.
![python](http://i.imgur.com/bc2xk.png)
Landslide is primarily written in Python, but it's themes use:
- HTML5
- Javascript
- CSS
---
# Code Sample
Landslide supports code snippets
!python
def log(self, message, level='notice'):
if self.logger and not callable(self.logger):
raise ValueError(u"Invalid logger set, must be a callable")
if self.verbose and self.logger:
self.logger(message, level)
4
使用直接输出
# Landslide
---
# Overview
Generate HTML5 slideshows from markdown, ReST, or textile.
![python](http://i.imgur.com/bc2xk.png)
Landslide is primarily written in Python, but it's themes use:
- HTML5
- Javascript
- CSS
---
# Code Sample
Landslide supports code snippets
!python
def log(self, message, level='notice'):
if self.logger and not callable(self.logger):
raise ValueError(u"Invalid logger set, must be a callable")
if self.verbose and self.logger:
self.logger(message, level)
5
使用另一个滑坡主题
# Landslide --- # Overview Generate HTML5 slideshows from markdown, ReST, or textile. ![python](http://i.imgur.com/bc2xk.png) Landslide is primarily written in Python, but it's themes use: - HTML5 - Javascript - CSS --- # Code Sample Landslide supports code snippets !python def log(self, message, level='notice'): if self.logger and not callable(self.logger): raise ValueError(u"Invalid logger set, must be a callable") if self.verbose and self.logger: self.logger(message, level)6
嵌入base-64编码图像
# Landslide --- # Overview Generate HTML5 slideshows from markdown, ReST, or textile. ![python](http://i.imgur.com/bc2xk.png) Landslide is primarily written in Python, but it's themes use: - HTML5 - Javascript - CSS --- # Code Sample Landslide supports code snippets !python def log(self, message, level='notice'): if self.logger and not callable(self.logger): raise ValueError(u"Invalid logger set, must be a callable") if self.verbose and self.logger: self.logger(message, level)7
导出为PDF
# Landslide
---
# Overview
Generate HTML5 slideshows from markdown, ReST, or textile.
![python](http://i.imgur.com/bc2xk.png)
Landslide is primarily written in Python, but it's themes use:
- HTML5
- Javascript
- CSS
---
# Code Sample
Landslide supports code snippets
!python
def log(self, message, level='notice'):
if self.logger and not callable(self.logger):
raise ValueError(u"Invalid logger set, must be a callable")
if self.verbose and self.logger:
self.logger(message, level)
8
启用降价扩展
请参阅有关可用降价扩展的文档 这里 :
# Landslide --- # Overview Generate HTML5 slideshows from markdown, ReST, or textile. ![python](http://i.imgur.com/bc2xk.png) Landslide is primarily written in Python, but it's themes use: - HTML5 - Javascript - CSS --- # Code Sample Landslide supports code snippets !python def log(self, message, level='notice'): if self.logger and not callable(self.logger): raise ValueError(u"Invalid logger set, must be a callable") if self.verbose and self.logger: self.logger(message, level)9
主题化
暗滑主题是一个遵循此简单结构的目录:
$ pip install landslide0
如果主题不提供html和js文件,那么 将使用主题。css不是可选的。
最后,还可以将整个主题目录复制到演示文稿中 一种方法是将 --copy theme 选项传递给 darkslide 命令:
$ pip install landslide1
用户样式表和Java脚本
如果你不想费心制作自己的主题,你可以包括 在生成的演示文稿中拥有用户css和js文件。
此功能I只有在使用暗滑配置时才可用 文件,通过设置 css 和/或 js 标志:
$ pip install landslide2
它们将链接 custom.css 样式表和 jquery.js 以及 演示文稿HTML文件。
注意: 指向css和js文件的路径必须与 从中运行 darkslide 命令的目录。
在线发布演示文稿
如果你想在线发布你的html演示文稿,你必须 使用 --relative 选项,以及 --将主题复制到 拥有与演示文稿根目录相关的所有资源链接;
$ pip install landslide3
这样,您只需将整个演示目录托管到 网络服务器。当然,除了http,没有python、php或其他任何东西 web服务器(如apache)需要主持一个darkslide演示文稿。
主题变量
base.html 必须是a jinja2模板 文件 利用以下模板变量:
- css :样式表内容,通过两个键提供, print 和屏幕,都有:
- a path_url 键存储指向资产文件路径的url
- a 内容 键存储资产内容
- js :javascript内容,具有:
- a path_url 键存储指向资产文件路径的url
- a 内容 键存储资产内容
- 幻灯片 :幻灯片列表,每个幻灯片都具有以下属性:
- 标题 :幻灯片标题
- 内容 :幻灯片内容
- 编号 :幻灯片编号
- 嵌入:当前文档是独立文档吗?
- 幻灯片数 :当前演示文稿中的幻灯片数
- toc :目录,列出文档的各个部分。 每个部分都有以下可用属性:
- 标题 :节标题
- 编号 :节段的幻灯片编号
- sub :子部分,如果有
样式范围
- 要更改HTML5演示样式,请调整 css/screen.css 与正在使用的主题捆绑在一起的样式表
- 对于pdf,修改 css/print.css