markdown-it / markdown-it-container

Fenced container plugin for markdown-it markdown parser
MIT License
496 stars 74 forks source link

Allowing arbitrary container names (i.e., not specified in advance)? #45

Closed rauschma closed 9 months ago

rauschma commented 1 year ago

If I write Markdown, I’d love to be able to use any CSS class I like – without the parser having to know about it in advance.

If someone needs more control, they can use method .validate().

Use cases:

marcselman commented 1 year ago

Yeah, that seems pretty basic. Markdig (for C#) supports that and you can even leave out the name so it will just generate a div without a class name. https://github.com/xoofx/markdig/blob/master/src/Markdig.Tests/Specs/CustomContainerSpecs.md

rauschma commented 1 year ago

Update: I tried rewriting the code to allow arbitrary names and, as far as I can tell, it doesn’t support nesting of containers with different names (due to how it detects closing delimiters).

That prevents many use cases for arbitrarily named containers.

puzrin commented 9 months ago

Closing, since should be doable on the user side via customizations.

uncenter commented 9 months ago

This is what I've done to enable arbitrary names: https://gist.github.com/uncenter/5db09920e8fe879c38e96e59b2367895