From: Slaughter, A. E <and...@in...> - 2016-05-25 23:48:53
|
I am working on creating a custom extension to parse markdown into Reveal.js <http://lab.hakim.se/reveal-js/#/> slides. I understand that Reveal.js already understands markdown, but I want to parse additional custom syntax that I already generated, thus I want to convert to html directly. Has anyone done something similar or can someone provide me with a similar example? I am just looking for something to kick me in the proper direction, I have created custom pattern extensions but I believe I will need a BlockProcessor or possibly a Preprocessor to do this. In short, I need to convert the demo.md to the demo.html shown below, which simply requires the delimiter (!---) to mark the location of a <section> break. Any help pointing me in the correct direction would be greatly appreciated. ---demo.md-------------------------------------------------------------- Slide 1 * Item 1 * Item 2 !--- Slide 2 Some thing really import goes here, with custom markdown syntax. !--- Slide 3 ```python for i in range(10): print i ``` This needs to be converted to, notice the '!---' lines are replace with <section>. ---demo.html---------------------------------------------------------------- <section> <p>Slide 1</p> <ul> <li>Item 1</li> <li>Item 2</li> </ul> </section> <section> <p>Slide 2</p> <p>Some thing really import goes here, with custom markdown syntax.</p> </section> <section> <p>Slide 3</p> <p><code>python for i in range(10): print i</code></p> </section> |