Rewriting HTML output - where to start? #641

Open
opened 2026-01-29 14:41:49 +00:00 by claunia · 1 comment
Owner

Originally created by @NetTecture on GitHub (Nov 29, 2023).

I need to add additional classes - the bootstrap extension is nice, but it is "only" doing "standard" bootstrap, which is not enough. I need in particular:

  • to add more .class depending on the context in markdown

Example would be to have a HR before the 2nd H2 to isolate the top paragraph, or another HR before the last H2.

  • rewrite the URL of images also based on context.

The use case here is to change the URL to be a specific size, depending on the context again - but mostly depending on the theme. Full original size is behind a click.

Originally created by @NetTecture on GitHub (Nov 29, 2023). I need to add additional classes - the bootstrap extension is nice, but it is "only" doing "standard" bootstrap, which is not enough. I need in particular: * to add more .class depending on the context in markdown Example would be to have a HR before the 2nd H2 to isolate the top paragraph, or another HR before the last H2. * rewrite the URL of images also based on context. The use case here is to change the URL to be a specific size, depending on the context again - but mostly depending on the theme. Full original size is behind a click.
claunia added the question label 2026-01-29 14:41:49 +00:00
Author
Owner

@xoofx commented on GitHub (Nov 29, 2023):

It will be most likely a mix of rewriting some of the builtin renderers and change things in the document object model before rendering it back.

@xoofx commented on GitHub (Nov 29, 2023): It will be most likely a mix of rewriting some of the builtin [renderers](https://github.com/xoofx/markdig/tree/master/src/Markdig/Renderers/Html) and change things in the document object model before rendering it back.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#641