I create Sphinx extension to convert Reveal.js presentation from plain reStructuredText. please try it, if you match want to write Reveal.js by Sphinx(reStructuredText)
attakei / sphinx-revealjs
Sphinx builder to revealjs presentations
sphinx-revealjs
Sphinx extention with theme to generate Reveal.js presentation
Orverview
This extension generate Reveal.js presentation from standard reStructuredText.
It include theses features.
- Custom builder to translate from reST to reveal.js style HTML
- Template to be enable to render presentation local imdependent
Installation
$ pip install sphinx-revealjs
Usage
-
Create your sphinx documentation
-
Edit conf.py to use this extension
extensions = [ 'sphinx_revealjs', ]
-
Write source for standard document style
-
Build sources as Reveal.js presentation
$ make revealjs
Change logs
See it
Futures
- Index template as none presentation
- CDN support
Copyright
Apache-2.0 license. Please see LICENSE.
If you want to see source and output, click these links. These are pair of simple reST source and generated presentation.
- Source from
- Output to
Installation and usage
Installation
$ pip install git+https://github.com/attakei/sphinx-revealjs$ pip install git+https://github.com/attakei/sphinx-revealjs$ pip install git+https://github.com/attakei/sphinx-revealjs
Usage
- Add extension to your sphinx
conf.py
extensions = ['sphinx_revealjs',]extensions = [ 'sphinx_revealjs', ]extensions = [ 'sphinx_revealjs', ]
- Write your presentation source by reST, and build
$ make revealjs$ make revealjs$ make revealjs
Concepts
- Use default nodes and directives as more as possible
- Manage multiple presentations in one Sphinx documentation
- and, can switch themes per documents
Supporting features in reST
- Section (convert reveal.js section)
- Comment (use for speaker note)
- Code block (convert reveal.js style code block)
- And other directives (inherit Sphinx HTML5 builder)
Short examples for convert
Your write source like this..
=====Title=====Section 1=========content 1Section 2=========content 2===== Title ===== Section 1 ========= content 1 Section 2 ========= content 2===== Title ===== Section 1 ========= content 1 Section 2 ========= content 2
It can convert this
<span><section></span><span><h1></span>Title<span></h1></span><span></section></span><span><section></span><span><h2></span>Section 1<span></h2></span><span><div></span>content 1<span></div></span><span></section></span><span><section></span><span><h2></span>Section 2<span></h2></span><span><div></span>content 2<span></div></span><span></section></span><span><section></span> <span><h1></span>Title<span></h1></span> <span></section></span> <span><section></span> <span><h2></span>Section 1<span></h2></span> <span><div></span>content 1<span></div></span> <span></section></span> <span><section></span> <span><h2></span>Section 2<span></h2></span> <span><div></span>content 2<span></div></span> <span></section></span><section> <h1>Title</h1> </section> <section> <h2>Section 1</h2> <div>content 1</div> </section> <section> <h2>Section 2</h2> <div>content 2</div> </section>
Of course, support nested section.
from
=====Title=====Section 1=========content 1.1-----------content bodycontent 1.2-----------content body===== Title ===== Section 1 ========= content 1.1 ----------- content body content 1.2 ----------- content body===== Title ===== Section 1 ========= content 1.1 ----------- content body content 1.2 ----------- content body
to
<span><section></span><span><h1></span>Title<span></h1></span><span></section></span><span><section></span><span><section></span><span><h2></span>Section 1<span></h2></span><span></section></span><span><section></span><span><h3></span>content 1.1<span></h3></span><span><div></span>content body<span></div></span><span></section></span><span><section></span><span><h3></span>content 1.2<span></h3></span><span><div></span>content body<span></div></span><span></section></span><span></section></span><span><section></span> <span><h1></span>Title<span></h1></span> <span></section></span> <span><section></span> <span><section></span> <span><h2></span>Section 1<span></h2></span> <span></section></span> <span><section></span> <span><h3></span>content 1.1<span></h3></span> <span><div></span>content body<span></div></span> <span></section></span> <span><section></span> <span><h3></span>content 1.2<span></h3></span> <span><div></span>content body<span></div></span> <span></section></span> <span></section></span><section> <h1>Title</h1> </section> <section> <section> <h2>Section 1</h2> </section> <section> <h3>content 1.1</h3> <div>content body</div> </section> <section> <h3>content 1.2</h3> <div>content body</div> </section> </section>
原文链接:Sphinx extension to generate Reveal.js presentation from plain reST
暂无评论内容