Skip to content

Commit

Permalink
Document workaround for sphinx-extensions2#3
Browse files Browse the repository at this point in the history
  • Loading branch information
eudoxos committed Sep 26, 2024
1 parent 5f8e3aa commit 0a2997b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,37 @@ Warning messages are displayed in the Sphinx build output, for problematic input
Since is difficult / impossible to map the source line numbers, from the template to the Jinja rendered content,
problems with the parsing of the rendered content always refer to the first line number either of the ``jinja`` directive, or the template file (when using the ``file`` option).


Known issues
-------------

* [#3](https://github.com/sphinx-extensions2/sphinx-jinja2/issues/3): template output is fed back into the RST parser. When the source uses `MyST parser <https://myst-parser.readthedocs.io/en/latest/index.html>`__, this will trigger an error::

Directive 'jinja' cannot be mocked: MockingError: MockStateMachine has not yet implemented 'insert_input'.


The workaround is to wrap the `jinja` directive inside `rst-eval`

.. code-block:: rst

```{rst-eval}
.. jinja::
:ctx: {"foo":"bar"}

Baz.
```

rather than using it directly:

.. code-block:: markdown

```{jinja}
:ctx: {"foo":"bar"}

Baz.
```


Configuration
-------------

Expand Down

0 comments on commit 0a2997b

Please sign in to comment.