Files
sphinx/tests/roots/test-ext-math-compat/conf.py
2019-03-30 14:50:37 +09:00

21 lines
488 B
Python

from docutils import nodes
from docutils.parsers.rst import Directive
extensions = ['sphinx.ext.mathjax']
def my_math_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
text = 'E = mc^2'
return [nodes.math(text, text)], []
class MyMathDirective(Directive):
def run(self):
text = 'E = mc^2'
return [nodes.math_block(text, text)]
def setup(app):
app.add_role('my_math', my_math_role)
app.add_directive('my-math', MyMathDirective)