Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't working
Description
Describe the bug
context
If I put a rST substitution (like |wrench|) that expands to raw HTML into the content of a button-ref directive, it gets mis-rendered as a textual version of the HTML (see screenshot below). This doesn't happen for button-link directive.
expectation
I expected button-ref and button-link to behave the same in this regard.
problem
This is a problem for people using rST substitutions as shorthand for, e.g., inline icons. I know that sphinx-design provides some support for octicon, font-awesome, etc, but the same thing happens to those! E.g., putting an octicon into the button text of a button-ref yields this:
Reproduce the bug
.. |wrench| raw:: html
<i class="fas fa-wrench"></i>
.. grid:: 3
.. grid-item-card::
.. button-link:: https://example.com/
|wrench| works with button-link
.. grid-item-card::
.. button-ref:: name-of-target-anchor
:ref-type: ref
|wrench| fails with button-ref
.. grid-item-card::
.. button-ref:: name-of-target-anchor
:ref-type: ref
:octicon:`download` Fails with octicons in button-ref tooList your environment
I'm using sphinx-design via pydata-sphinx-theme, not jupyter-book:
$ mamba list sphinx
jupyter_sphinx 0.3.2 py310hff52083_0 conda-forge
pydata-sphinx-theme 0.8.1 pypi_0 pypi
sphinx 4.5.0 pyh6c4a22f_0 conda-forge
sphinx-autobuild 2021.3.14 pyhd8ed1ab_0 conda-forge
sphinx-copybutton 0.5.0 pypi_0 pypi
sphinx-design 0.1.0 pyhd8ed1ab_0 conda-forge
sphinx-gallery 0.11.0.dev0 dev_0 <develop>
sphinx-sitemap 2.2.0 pyhd8ed1ab_0 conda-forge
sphinx-theme-builder 0.2.0a14 pyhd8ed1ab_0 conda-forge
sphinxcontrib-applehelp 1.0.2 py_0 conda-forge
sphinxcontrib-bibtex 2.4.2 pyhd8ed1ab_0 conda-forge
sphinxcontrib-devhelp 1.0.2 py_0 conda-forge
sphinxcontrib-htmlhelp 2.0.0 pyhd8ed1ab_0 conda-forge
sphinxcontrib-jsmath 1.0.1 py_0 conda-forge
sphinxcontrib-qthelp 1.0.3 py_0 conda-forge
sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_2 conda-forge
sphinxext-rediraffe 0.2.7 pyhd8ed1ab_0 conda-forgeMetadata
Metadata
Assignees
Labels
bugSomething isn't working



Activity
welcome commentedon May 25, 2022
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗
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! 🎉
OriolAbril commentedon Aug 10, 2022
Not sure if this is an option for you, but this can be fixed if using myst-parser by changing the
ref-typeto myst. I don't know how the internals work, and I am also not sure if this might be a "wontfix" type of issue.The "workaround" is documented in https://sphinx-design.readthedocs.io/en/sbt-theme/badges_buttons.html#buttons:
drammock commentedon Aug 10, 2022
thanks for pointing out that this is a documented limitation, somehow I missed that (or didn't make the connection that the raw-text problem was the same problem as what I've reported here).
The workaround is probably a non-starter; translating whole pages of our docs from rST to Myst just to get an icon to display on a button --- I doubt any of our devs will consider that a worthwhile use of their time.
The docs you quoted say that by default sphinx converts the content of references to raw text... could we do something non-default here? Can you point me to where in sphinx-design (or sphinx) I should look to try to fix this myself?
chrisjsewell commentedon Aug 10, 2022
Well you can see my rejected feature request here 😢 sphinx-doc/sphinx#8068
chrisjsewell commentedon Aug 15, 2022
Yeh I think supporting such a complex non-default behaviour here would not be feasible, so I am going to move this to won't fix. But I'm open to suggestions on simpler fixes 😬