markup icon indicating copy to clipboard operation
markup copied to clipboard

RestructuredText: warning and note directives are not properly rendered

Open berndschatz opened this issue 3 years ago • 16 comments

text of warning / note directives should be rendered in a box or/and in another color.

Currently it looks like this:

note

This is a note

but it should look somehow like here -->

2023-04-11-114318_1088x130_scrot

see also --> https://sublime-and-sphinx-guide.readthedocs.io/en/latest/notes_warnings.html

IMHO this would be a big improvement for the readability of technical documentation with less effort for you for the implementation.

berndschatz avatar Apr 11 '23 09:04 berndschatz

Notes used to render with a little blue "info" icon, and warnings with a little yellow "warning" icon... but not anymore.

ichordev avatar Jul 23 '23 17:07 ichordev

Maybe this broke it? https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/

flying-sheep avatar Mar 19 '24 09:03 flying-sheep

Maybe this broke it? https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/

This is markdown (that is designed for small blog entries), we use/need RestructuredText (that is designed for technical documentation).

berndschatz avatar Mar 19 '24 09:03 berndschatz

Hold your horses, I’m with you haha. In this community discussion, they describe that they broke the rendering for the old markdown way of doing admonitions.

What I’m implying (but could have been clear about) is that maybe they still make rST render to whatever intermediate representation the old Markdown syntax rendered to and that way broke it?

Or maybe they never supported it, I don’t remember. Since they do support admonition rendering in Markdown, they should make rST and Asciidoc admonitions render the same way.

flying-sheep avatar Mar 19 '24 09:03 flying-sheep

Don't know what they do, the docutils works fine, so i assume they have some own stuff: post/pre-processor before / after using the docutils !? Or do they implement a complete own ResT parser !?

PS: Regarding automated testing, there are probably still a few areas for improvement for ResT (and markdown):

berndschatz avatar Mar 19 '24 09:03 berndschatz

Stale issue message

github-actions[bot] avatar Jul 15 '24 12:07 github-actions[bot]

Not-a-stale-issue response

@humans please pin and make the bot go away thanks

flying-sheep avatar Jul 20 '24 10:07 flying-sheep

Just for reference #68 was closed several years ago, because at the time it couldn't be implemented. I'm hoping that things have changed enough since then that'll be possible to provide the same experience to ReST than it is available with GFM.

ErraticMaker avatar Jul 30 '24 18:07 ErraticMaker

Stale issue message

github-actions[bot] avatar Sep 29 '24 12:09 github-actions[bot]

Still not stale. Please please add a label that shuts up the bot!

flying-sheep avatar Sep 30 '24 07:09 flying-sheep

@jmeridth could you please take a look here? Either #68 needs to be reopened or this needs to be triaged and labelled correctly.

The closing reason for #68 is no longer valid

flying-sheep avatar Nov 18 '24 10:11 flying-sheep

@jmeridth could you please take a look here? Either #68 needs to be reopened or this needs to be triaged and labelled correctly.

The closing reason for #68 is no longer valid

@flying-sheep Taking a look. I've also added the keep label to avoid being flagged by the stale bot. Thanks for the bump.

jmeridth avatar Nov 18 '24 15:11 jmeridth

Related discussions, issues:

"No one seems to mention that so far: is the root cause of all these due to GitHub switched from using sphinx to render rst to using pandoc to convert rst to md (or similar) and render from there?"

  • potentially related, as @flying-sheep noted in this issue: https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/

evdcush avatar Dec 30 '25 18:12 evdcush

When editing wiki pages, the GitHub user interface has an Edit mode: drop-down menu that includes the reStructuredText option; it's been years since this issue was opened, but that official edit mode remains partially broken?

megapatato avatar Feb 15 '26 00:02 megapatato

Thanks for the report, and thanks for the detailed examples.

After investigating, this repo's RST renderer (via docutils) does generate correct semantic HTML for admonitions — including proper class="admonition note" and class="admonition warning" attributes. The raw HTML output from this gem is correct.

However, the issue is in step 2 of the rendering pipeline: GitHub's HTML sanitizer aggressively strips class and id attributes. Check out this part of the README for a fuller picture:

The HTML is sanitized, aggressively removing things that could harm you and your kin — such as script tags, inline-styles, and class or id attributes.

Without those class attributes, the admonitions render as plain unstyled <div> elements. This is a downstream sanitization/styling issue that this repo can't address — the correct HTML is being generated, but it's stripped before display.

For admonition styling support, GitHub's feedback discussions would be the right venue to request that the sanitizer preserve or re-add admonition classes.

Closing as out of scope for this repository.

zkoppert avatar Apr 24 '26 06:04 zkoppert

@zkoppert already exists, can you please elevate that to an internal issue/task? https://github.com/orgs/community/discussions/45829

flying-sheep avatar Apr 24 '26 07:04 flying-sheep