MyST-Parser
MyST-Parser copied to clipboard
inline attribute on hyperlink disappears in LaTeX (but is there in HTML)
What version of myst-parser
are you using?
2.0.0
What version dependencies are you using?
Sphinx 7.2.5, docutils 0.19
What operating system are you using?
Linux
Describe the Bug
I am trying to assign a custom class to hyperlink via [test](target){.myattr}
. This works for HTML (<a class="myattr ..." href="target">text</a>
appears in the page) but there is nothing in LaTeX (the source says \sphinxhref{target}{text}
without any mention of myattr
).
Using custom role (myrole
in the MWE below; for regular text, not hyperlink) does appear in both HTML and LaTeX (as \DUrole{myrole}{text}
).
index.md
```{role} myrole
```
# Test page
* This is a [test link with the myattr](https://example.com){.myattr}.
* This is a {myrole}`test text with myrole`.
conf.py
project = 'Test'
extensions = ['myst_parser']
myst_enable_extensions=['attrs_inline']
Expected Behavior
Inline attribute behaves the same as custom role and is exported to both HTML and LaTeX (thus producing something like \DUrole{myrole}{\sphinxhref{target}{text}}
)
To Reproduce
index.md
and conf.py
above are minimal example which exhibits the behavior; run sphixn-build
to get the outputs:
sphinx-build -M html . _build
sphinx-build -M latex . _build
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada: