diff --git a/src/nbsphinx.py b/src/nbsphinx.py index 54fcd46b..4b709fbb 100644 --- a/src/nbsphinx.py +++ b/src/nbsphinx.py @@ -162,6 +162,10 @@ {{ output.data[datatype] | escape_latex | ansi2latex | indent | indent }} \\end{sphinxVerbatim} + .. raw:: text + +{{ output.data[datatype] | indent | indent }} + {%- elif datatype in ['image/svg+xml', 'image/png', 'image/jpeg', 'application/pdf'] %} .. image:: {{ output.metadata.filenames[datatype] | posix_path }} @@ -2254,6 +2258,14 @@ def depart_admonition_latex(self, node): self.body.append('\\end{sphinxadmonition}\n') +def visit_admonition_text(self, node): + self.new_state(0) + + +def depart_admonition_text(self, node): + self.end_state() + + def depart_gallery_html(self, node): for title, uri, filename, tooltip in node['entries']: if tooltip: @@ -2318,16 +2330,20 @@ def setup(app): app.add_directive('nbgallery', NbGallery) app.add_node(CodeAreaNode, html=(do_nothing, depart_codearea_html), - latex=(visit_codearea_latex, depart_codearea_latex)) + latex=(visit_codearea_latex, depart_codearea_latex), + text=(do_nothing, do_nothing)) app.add_node(FancyOutputNode, html=(do_nothing, do_nothing), - latex=(visit_fancyoutput_latex, depart_fancyoutput_latex)) + latex=(visit_fancyoutput_latex, depart_fancyoutput_latex), + text=(do_nothing, do_nothing)) app.add_node(AdmonitionNode, html=(visit_admonition_html, depart_admonition_html), - latex=(visit_admonition_latex, depart_admonition_latex)) + latex=(visit_admonition_latex, depart_admonition_latex), + text=(visit_admonition_text, depart_admonition_text)) app.add_node(GalleryNode, html=(do_nothing, depart_gallery_html), - latex=(do_nothing, do_nothing)) + latex=(do_nothing, do_nothing), + text=(do_nothing, do_nothing)) app.connect('builder-inited', builder_inited) app.connect('config-inited', config_inited) app.connect('html-page-context', html_page_context)