From 3c6c6b93b0dc527d583e40cbf4074675f7aeaae6 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 2 Jan 2022 11:04:48 +0100 Subject: [PATCH] Avoid empty "raw" directive --- src/nbsphinx.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nbsphinx.py b/src/nbsphinx.py index aede8404..c6e23aa2 100644 --- a/src/nbsphinx.py +++ b/src/nbsphinx.py @@ -162,9 +162,12 @@ {{ output.data[datatype] | escape_latex | ansi2latex | indent | indent }} \\end{sphinxVerbatim} +{# NB: The "raw" directive doesn't work with empty content #} +{%- if output.data[datatype].strip() %} .. raw:: text {{ output.data[datatype] | indent | indent }} +{%- endif %} {%- elif datatype in ['image/svg+xml', 'image/png', 'image/jpeg', 'application/pdf'] %}