nyergler / hieroglyph

Generate HTML presentations from plain text sources with all the power of Sphinx.
https://hieroglyph.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
261 stars 73 forks source link

`nextslide` directive does work well with math in section headings #85

Closed joonro closed 9 years ago

joonro commented 9 years ago

I found that when I have math in a section heading, nextslide directive does not work well. I put what happens in the slide body in the following example.

:math:`y`
---------

Section with its heading contains math

.. nextslide::
   :increment:

This slide's heading only shows (2)

.. nextslide:: :math:`y` (3)

This slide's heading shows ``:math:`y` (3)`` (literally - with math not rendered).
nyergler commented 9 years ago

This is probably due to how the nextslide directive inserts the new section headings and splits the content. nextslide is implemented primarily as a transform. If I recall correctly, I implemented it as a transform because it was easier to insert the new heading (and make the subsequent content belong to it) once the entire document tree had been read.

As you can see in the transform source (https://github.com/nyergler/hieroglyph/blob/master/src/hieroglyph/directives.py#L148), the base title is obtained by doing parent.astext(), without subsequent parsing.

(I'm not sure off the top of my head why the second one is empty.)

nyergler commented 9 years ago

Thanks again for reporting this; nested markup in general should now work with the nextslide directive.