executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
730 stars 192 forks source link

inline attribute on hyperlink disappears in LaTeX (but is there in HTML) #876

Open eudoxos opened 6 months ago

eudoxos commented 6 months ago

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

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
welcome[bot] commented 6 months ago

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: