带有 Python 语法突出显示的 HTML 演示幻灯片
我想为我的演示文稿创建幻灯片。我的演示文稿将包含以下内容:幻灯片标题、项目符号点、代码片段(等宽字体)、一些以粗体突出显示的代码行、Python 代码片段(带有语法突出显示)。
我需要一个可以在 HTML(或 HTML5)中生成此类幻灯片的应用程序或工具,因此当我在 Web 浏览器中打开生成的 HTML 并将 Web 浏览器设置为全屏模式时,它将开始幻灯片放映。我更喜欢将演示文稿编写为带有一些标记的 .txt
文件,然后该工具应生成 HTML。
我知道 Google Docs 的演示功能,但它不支持 Python 语法突出显示。
我还了解 LaTeX 和 Beamer,但这会生成 PDF 而不是 HTML(不是一个大问题) ,并且没有内置的 Python 语法突出显示。
我更喜欢使用普通的 Google Chrome 或 Mozilla Firefox 来投影我的演示文稿。我不想在投影机上安装任何演示软件(例如 bruce) 。
还有其他选择吗?
I'd like to create slides for my presentation. My presentation will contain these: slide title, bullet points, code snippets (in a monospace font), some code lines highlighted as bold, Python code snippets (with syntax highlighting).
I need an application or tool which can generate such slides in HTML (or HTML5), so when I open the generated HTML in my web browser, and put the web browser to full screen mode, it will start the slideshow. I prefer writing my presentation as a .txt
file with some markup, and then the tool should generate the HTML.
I know about the presentation feature Google Docs, but that doesn't support Python syntax highlighting.
I also know about LaTeX and Beamer, but that would generate PDF instead of HTML (not a big problem), and doesn't have Python syntax highlighting built in.
I'd prefer projecting my presentation using a vanilla Google Chrome or Mozilla Firefox. I don't want to install any presentation software (such as bruce) on the projecting machine.
Is there an alternative?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
尝试以下方法之一:
使用 S5 重构文本
http://meyerweb.com/eric/tools/s5/
http://docutils.sourceforge.net/docs/user/slide-显示.html
如果您安装docutils(首选快照),您将在tools文件夹中获得rst2s5.py。
Bruce,演示工具
http://code.google.com/p/bruce-tpt/
Pandoc:通用文档转换器
http://johnmacfarlane.net/pandoc/
AsciiDoc 有一个选项可以生成生成自包含的 Slidy HTML
Try one of the following:
Restructured text with S5
http://meyerweb.com/eric/tools/s5/
http://docutils.sourceforge.net/docs/user/slide-shows.html
If you install docutils (snapshot is preferred), you will get rst2s5.py in the tools folder.
Bruce, The Presentation Tool
http://code.google.com/p/bruce-tpt/
Pandoc: a universal document converter
http://johnmacfarlane.net/pandoc/
AsciiDoc has an option to generate generate self-contained Slidy HTML
就在最近,出现了 slippy:将演示文稿编辑为 HTML,并突出显示 Python(和许多其他语言)。
Just recently slippy appeared: edit your presentation as HTML, with Python (and lots of other languages) highlighting.
你绝对应该看看landslide,这是一个Python应用程序,可以用它创建非常漂亮的幻灯片HTML5来自markdown格式的文本,并且它支持语法高亮。要预览它的功能,只需查看从项目的自述文件。
You should definitely take a look at landslide, this is a python app that allows to create really nice looking slides in HTML5 from markdown formatted text, and it supports syntax highlighting. To have a preview of what it can do, just take a look at the sample slideshow generated from the project's README.
html5slides 是一个不错的选择。
http://code.google.com/p/html5slides/
html5slides is great option.
http://code.google.com/p/html5slides/
这只是您所要求的一部分,但是如果您想要对 Python 进行语法突出显示并转换为 HTML,那么您可以在 Emacs 中使用
python-mode
来执行语法突出显示并htmlize
转换为 HTML。例如,您可能会从
htmlize
开始,然后通过
htmlize
您会得到:您可以看到每个语法都用属于一个的
进行标记。 class 指示它属于哪个语法类:然后您可以使用 CSS 来指定您想要的颜色。 (
htmlize
可以配置为指定显式颜色 -- 但类/CSS 方法更灵活。)
作为幻灯片生成过程的一部分,这可以轻松实现自动化,但我认为这对于一个答案来说已经足够了。
It's only a part of what you're asking for, but if you want to do syntax-highlighting of Python and conversion to HTML, then you can do this in Emacs using
python-mode
to do the syntax highlighting andhtmlize
to do the conversion to HTML.For example, you might start with
and after passing through
htmlize
you get:You can see that each piece of syntax is marked up with a
<span>
that belongs to a class indicating which syntax class it belongs to: you can then use CSS to specify the colours you want. (htmlize
can be configured to specify explicit colours instead —<span style="color:#b22222">
— but the class/CSS approach is more flexible.)This can be easily automated as part of your slide-generation process, but I think that's enough for one answer.