matplotlib icon indicating copy to clipboard operation
matplotlib copied to clipboard

[Doc]: Thumbnail title in gallery show rst formatting characters

Open StefRe opened this issue 2 years ago • 7 comments

Documentation Link

https://matplotlib.org/devdocs/tutorials/index.html#intermediate

Problem

for instance here:

image

This is caused by https://github.com/sphinx-gallery/sphinx-gallery/pull/906. I'm not sure if this can be fixed on matplotlib's side or must be addressed in sg. See also https://github.com/sphinx-gallery/sphinx-gallery/issues/998.

Suggested improvement

The title should be just origin and extent in imshow without *, ~.Axes. prefix and backticks.

StefRe avatar Sep 13 '22 19:09 StefRe

Agreed that we should not use markup in headings.

Maybe we can make the wording more explicit though. How about

imshow(): Behavior of parameters origin and extent

timhoffm avatar Sep 13 '22 20:09 timhoffm

It would be best if this were fixed in sphinx-gallery; never know if we might accidentally introduce formatting in a title somewhere later, even if we fix them all now.

QuLogic avatar Sep 13 '22 20:09 QuLogic

The question generally is how? While emphasis may be viable, do you really want to have links, literal code etc in a title?

timhoffm avatar Sep 13 '22 21:09 timhoffm

We already disallow links in headings, but it's only enforced when we notice it. For the sphinx-gallery cards, it'd be better to strip all formatting.

QuLogic avatar Sep 14 '22 00:09 QuLogic

My intention when opening this issue was not so much to change the examples and tutorials but restore the behavior of sg < 0.11.0 where any formatting was stripped from the title, see the old docs:

grafik

The question was more if this could be achieved by some CSS voodoo on the part of matplotlib instead of waiting for a fix in sg.

StefRe avatar Sep 14 '22 06:09 StefRe

This would need to be addressed in Sphinx-gallery.

timhoffm avatar Sep 14 '22 06:09 timhoffm

I've opened an issue there: https://github.com/sphinx-gallery/sphinx-gallery/issues/1002

StefRe avatar Sep 14 '22 06:09 StefRe

The original example above has no thumbnail anymore (due to #25395). With Sphinx Gallery 0.12.2 and https://github.com/sphinx-gallery/sphinx-gallery/pull/1108 there's only a single case left which will be fixed by #25508 .

StefRe avatar Mar 19 '23 21:03 StefRe