12

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?

pts
  • 80,836
  • 20
  • 110
  • 183

5 Answers5

12

Try one of the following:

  1. 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.

  2. Bruce, The Presentation Tool

    http://code.google.com/p/bruce-tpt/

  3. Pandoc: a universal document converter

    http://johnmacfarlane.net/pandoc/

  4. AsciiDoc has an option to generate generate self-contained Slidy HTML

bhadra
  • 12,887
  • 10
  • 54
  • 47
  • Thanks for compiling this long list. Please note that not every software you have mentioned supports syntax highlighting of Python source code (or, at least, it's not easy to find it). – pts Nov 12 '10 at 11:41
  • @pts: Since you can only show a very few lines of code on a slide, syntax highlighting isn't actually all that helpful. Have you actually tried one of these? – S.Lott Nov 12 '10 at 11:47
3

Just recently slippy appeared: edit your presentation as HTML, with Python (and lots of other languages) highlighting.

Ned Batchelder
  • 364,293
  • 75
  • 561
  • 662
2

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.

mdeous
  • 17,513
  • 7
  • 56
  • 60
2

html5slides is great option.

http://code.google.com/p/html5slides/

1

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 and htmlize to do the conversion to HTML.

For example, you might start with

def decode_safely(s, charset='ascii'):
    """Return s decoded according to charset, but do so safely."""
    try:
        return s.decode(charset or 'ascii', 'replace')
    except LookupError: # bogus charset
        return s.decode('ascii', 'replace')

and after passing through htmlize you get:

<pre><span class="keyword">def</span> <span class="function-name">decode_safely</span>(s, charset=<span class="string">'ascii'</span>):
    <span class="string">"""Return s decoded according to charset, but do so safely."""</span>
    <span class="keyword">try</span>:
        <span class="keyword">return</span> s.decode(charset <span class="keyword">or</span> <span class="string">'ascii'</span>, <span class="string">'replace'</span>)
    <span class="keyword">except</span> <span class="type">LookupError</span>: <span class="comment"># see job002442
</span>        <span class="keyword">return</span> s.decode(<span class="string">'ascii'</span>, <span class="string">'replace'</span>)
</pre>

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.

Gareth Rees
  • 64,967
  • 9
  • 133
  • 163
  • Thanks for giving this information. I know about other tools (such as pygments) which can generate syntax-highlighting using ``. I am able to automate the whole process if necessary. But I don't have time for that. – pts Nov 12 '10 at 11:21