Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Directive 'jinja' cannot be mocked: MockingError: MockStateMachine has not yet implemented attribute 'insert_input' #3

Open
ice-tong opened this issue Jul 26, 2024 · 1 comment

Comments

@ice-tong
Copy link

ice-tong commented Jul 26, 2024

Hi, thanks for the nice work! I found sphinx-jinja2 very useful when I needed to customise the generated documentation.

Since the generated documentation contains markdown syntax, I try to use myst-parser with sphinx-jinja2, but encountered the following error:

I’d be really grateful if you had any suggestions that could help me with this issue!

eudoxos added a commit to eudoxos/sphinx-jinja2 that referenced this issue Sep 26, 2024
@eudoxos
Copy link

eudoxos commented Sep 26, 2024

The template output is fed back into the RST parser. When the source uses MyST parser (please confirm), this error will be triggered:

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

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

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

      Baz.
```

rather than using it directly:

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

   Baz.
```

eudoxos added a commit to eudoxos/sphinx-jinja2 that referenced this issue Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants