Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow rendering HTML code blocks. #1812

Open
RokeJulianLockhart opened this issue Jun 12, 2024 · 4 comments
Open

Allow rendering HTML code blocks. #1812

RokeJulianLockhart opened this issue Jun 12, 2024 · 4 comments

Comments

@RokeJulianLockhart
Copy link

RokeJulianLockhart commented Jun 12, 2024

When a preformatted block (a <pre> or ```) is intelligently considered to contain HTML, or (especially) when a fenced code block explicitly states that it contains HTML, like ```HTML, its content should render if it does not contain disallowed content (per https://github.com/gjtorikian/html-pipeline/blob/11cec3d43cab9f6beddd95bda40ad6ac654fe2f8/lib/html/pipeline/sanitization_filter.rb#L44-L95 1). If it contains disallowed code, ideally that code should be (with a notification) merely not executed. However, I would understand if the option to render were disallowed too, if that were too difficult to implement for a reason unbeknownst to me.

I want this because I frequently want to cite a section of a static website in issues so that I and the viewer don't have to view a limited-resolution screenshot. I can already include a code block containing HTML, but a viewer of the issue must manually duplicate it to a local file and execute it, which isn't safe for them, and is a nuisance for us both.

Precedent exists for this in how Mermaid content already is, as https://github.com/github/docs/blob/f8992bc56c56b19e26af839b8fd427824cc99473/content/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams.md#creating-mermaid-diagrams explains.

Footnotes

  1. https://stackoverflow.com/revisions/23978592/1#:~:text=Github%20has%20open%20sourced%20their%20text%20processing%20pipeline.%20The%20definition%20of%20the%20tag%20whitelist%20can%20be%20found%20in%20the%20jch/html%2Dpipeline%20repository.

@RokeJulianLockhart RokeJulianLockhart changed the title Allow rendering fenced HTML code blocks. Allow rendering HTML code blocks. Jun 12, 2024
Copy link

Stale issue message

@RokeJulianLockhart

This comment was marked as duplicate.

Copy link

Stale issue message

@RokeJulianLockhart

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant