DefinitionList Extension does not allow custom attributes on description elements #54

Closed
opened 2026-01-29 14:23:36 +00:00 by claunia · 3 comments
Owner

Originally created by @aKzenT on GitHub (Sep 19, 2016).

For our project, I'm writing an extension which sets custom attributes on some Markdown Elements, which should be rendered in the resulting HTML (e.g. for styling).

This works fine for almost all elements (paragraphs, lists, etc.), but fails for the definition list extension, because it will always write an empty

element without honoring any attributes set on the description paragraph.

There is also currently no good workarround for this issue. I would currently need to copy the complete extension only to change this single part.

Best regards,
Thomas

Originally created by @aKzenT on GitHub (Sep 19, 2016). For our project, I'm writing an extension which sets custom attributes on some Markdown Elements, which should be rendered in the resulting HTML (e.g. for styling). This works fine for almost all elements (paragraphs, lists, etc.), but fails for the definition list extension, because it will always write an empty <dd> element without honoring any attributes set on the description paragraph. There is also currently no good workarround for this issue. I would currently need to copy the complete extension only to change this single part. Best regards, Thomas
claunia added the bug label 2026-01-29 14:23:36 +00:00
Author
Owner

@xoofx commented on GitHub (Sep 19, 2016):

Hm weird, the code here and there does write the attributes. Could you elaborate how do you add these attributes?

@xoofx commented on GitHub (Sep 19, 2016): Hm weird, the code [here](https://github.com/lunet-io/markdig/blob/master/src/Markdig/Extensions/DefinitionLists/HtmlDefinitionListRenderer.cs#L20) and [there](https://github.com/lunet-io/markdig/blob/master/src/Markdig/Extensions/DefinitionLists/HtmlDefinitionListRenderer.cs#L44) does write the attributes. Could you elaborate how do you add these attributes?
Author
Owner

@aKzenT commented on GitHub (Sep 19, 2016):

It't the
renderer.Write("<dd>");
that's causing the problem for me.

@aKzenT commented on GitHub (Sep 19, 2016): It't the `renderer.Write("<dd>");` that's causing the problem for me.
Author
Owner

@xoofx commented on GitHub (Sep 19, 2016):

Ah good catch, you can make a PR if you want to fix this.

@xoofx commented on GitHub (Sep 19, 2016): Ah good catch, you can make a PR if you want to fix this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#54