mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
Render Container - Only one class rendered #336
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @LukeTOBrien on GitHub (Nov 23, 2019).
Hello,
It seems that when I create a container with more than one class, only the first class is rendered.
The following Markdown:
I would expect the following:
Instead I am getting only the first class rendered.
I have created a .Net Fiddle to demo
I guess this is an issue with HtmlRenderer.WriteAttributes ?
Thanks
@xoofx commented on GitHub (Nov 23, 2019):
It is currently by design, not an issue with WriteAttributes, but it is similar to code fence where the only first element is taken and the following are extra arguments, but in the case of container they are probably not used. I don't remember the full details, but feel free to open a PR with appropriate tests if you want this behavior (and I don't remember if it could bring another issue)
@MihaZupan commented on GitHub (Nov 23, 2019):
As Alexandre said only the first item (the Info) is added as a class. The rest are added to the Arguments property, which is ignored when rendering HTML (but is exposed on the AST).
You can add them to the attributes like so:
An option to render arguments as classes could ofc be exposed if you think it is commonly desired behavior.
@LukeTOBrien commented on GitHub (Nov 23, 2019):
Okay understood, thanks for the code snippet.
I could possibly have a go at adding this feature, it seems a shame to waste arguments.
@xoofx commented on GitHub (Nov 23, 2019):
Yeah, the rationale of the name of a container is like a method name, and the arguments are on the side. You could develop a renderer that interprets them differently of generate a different HTML. The fact that the name of the container is put as a
classattribute is a default behavior for practical convenience. In case of adding arguments as class arguments as well is fine (for a default behavior), as long as we can switch it off by extension options.