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

Translate non-default directives (breathe extension) #323

Open
arwedus opened this issue Mar 2, 2021 · 4 comments · Fixed by breathe-doc/breathe#780
Open

Translate non-default directives (breathe extension) #323

arwedus opened this issue Mar 2, 2021 · 4 comments · Fixed by breathe-doc/breathe#780
Labels
enhancement New feature or request

Comments

@arwedus
Copy link

arwedus commented Mar 2, 2021

Is your feature request related to a problem? Please describe.

I cannot combine MyST with other non-default Sphinx extensions, like breathe.

In RST, I would write::

.. doxygenstruct:: MyStruct

(https://breathe.readthedocs.io/en/latest/struct.html)

If I try

```{doxygenstruct} MyStruct
```

in MyST, it returns the following error:

 WARNING: Unknown directive type "doxygenstruct".

Describe the solution you'd like

MyST should just let all directives through and pass handling of "unknown directive" to Sphinx itself.

Describe alternatives you've considered

Additional context

Tested with:

# Sphinx version: 3.5.1
# Python version: 3.6.9 (CPython)
# Docutils version: 0.16 release
# Jinja2 version: 2.11.3

# Loaded extensions:
#   sphinx.ext.mathjax (3.5.1) from /home/username/.local/lib/python3.6/site-packages/sphinx/ext/mathjax.py
#   sphinxcontrib.applehelp (1.0.2) from /home/username/.local/lib/python3.6/site-packages/sphinxcontrib/applehelp/__init__.py
#   sphinxcontrib.devhelp (1.0.2) from /home/username/.local/lib/python3.6/site-packages/sphinxcontrib/devhelp/__init__.py
#   sphinxcontrib.htmlhelp (1.0.3) from /home/username/.local/lib/python3.6/site-packages/sphinxcontrib/htmlhelp/__init__.py
#   sphinxcontrib.serializinghtml (1.1.4) from /home/username/.local/lib/python3.6/site-packages/sphinxcontrib/serializinghtml/__init__.py
#   sphinxcontrib.qthelp (1.0.3) from /home/username/.local/lib/python3.6/site-packages/sphinxcontrib/qthelp/__init__.py
#   alabaster (0.7.12) from /home/username/.local/lib/python3.6/site-packages/alabaster/__init__.py
#   breathe (4.27.0) from /home/username/.local/lib/python3.6/site-packages/breathe/__init__.py
#   sphinx.ext.autodoc.type_comment (3.5.1) from /home/username/.local/lib/python3.6/site-packages/sphinx/ext/autodoc/type_comment.py
#   sphinx.ext.autodoc (3.5.1) from /home/username/.local/lib/python3.6/site-packages/sphinx/ext/autodoc/__init__.py
#   sphinx.ext.doctest (3.5.1) from /home/username/.local/lib/python3.6/site-packages/sphinx/ext/doctest.py
#   sphinx.ext.todo (3.5.1) from /home/username/.local/lib/python3.6/site-packages/sphinx/ext/todo.py
#   sphinx.ext.ifconfig (3.5.1) from /home/username/.local/lib/python3.6/site-packages/sphinx/ext/ifconfig.py
#   sphinx.ext.viewcode (3.5.1) from /home/username/.local/lib/python3.6/site-packages/sphinx/ext/viewcode.py
#   sphinx.ext.extlinks (3.5.1) from /home/username/.local/lib/python3.6/site-packages/sphinx/ext/extlinks.py
#   sphinx_markdown_tables (<module 'sphinx_markdown_tables.__version__' from '/usr/local/lib/python3.6/dist-packages/sphinx_markdown_tables/__version__.py'>) from /usr/local/lib/python3.6/dist-packages/sphinx_markdown_tables/__init__.py
#   sphinxcontrib.confluencebuilder (1.4.0) from /home/username/.local/lib/python3.6/site-packages/sphinxcontrib/confluencebuilder/__init__.py
#   sphinxcontrib.plantuml (unknown version) from /usr/local/lib/python3.6/dist-packages/sphinxcontrib/plantuml.py
#   myst_parser (0.13.5) from /home/username/.local/lib/python3.6/site-packages/myst_parser/__init__.py
#   sphinx_git (unknown version) from /usr/local/lib/python3.6/dist-packages/sphinx_git/__init__.py
#   sphinx_rtd_theme (unknown version) from /usr/local/lib/python3.6/dist-packages/sphinx_rtd_theme/__init__.py
@arwedus arwedus added the enhancement New feature or request label Mar 2, 2021
@chrisjsewell
Copy link
Member

As with #322, this seems to be something to be an issue specific to https://github.com/michaeljones/breathe and the way it works in registering directives: https://github.com/michaeljones/breathe/blob/4ce8c7a0d79f79f0ae3e7c7fbaa9c4fbb5c84888/breathe/directives.py#L564-L573

There is usually just a simple cache linking directive names to directive classes, but it seems that doxygenstruct is not part of this 🤷

what happens if you do:

```{eval-rst}
.. doxygenstruct:: MyStruct
```

@chrisjsewell chrisjsewell changed the title Translate non-default directives Translate non-default directives (breathe extension) Mar 2, 2021
@arwedus
Copy link
Author

arwedus commented Mar 2, 2021

yes, that works. Actually, that works for me. Breathe directives are so far away from anything that is Markdown, so it's fine to put them in a code fence.

@chrisjsewell
Copy link
Member

chrisjsewell commented Mar 3, 2021

ah good to hear 👍 it would be nice to get to the bottom of why breathe seems to "break" myst-parser, but indeed for anything like this eval-rst is always the fallback

@jakobandersen
Copy link

This should be fixed in the next Breathe release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants