You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Don't put <p> around summary tag inside details with markdown flag set? #1079
summary is being treated as inline from what I can tell. You can modify the elements treated as block in a plugin though, or you can modify the block elements of the Markdown instance directly: https://github.com/Python-Markdown/markdown/blob/master/markdown/core.py#L75. Now, could we treat summary as a block element by default? That is up to @waylan, but this can be worked around.
Looking at the spec it seems that the summary tag is only valid as the first child of a detail tag and can only contain elements which a p tag can contain. Any other use would be invalid. Therefore...
We don't need to consider uses outside of detail. If a document author uses it in that way that is on them. In other words we don't need to be concerned with using a different parsing behavior outside of the very limited valid use-case.
Wrapping it in p would cause it to not be the first child of detail and therefore it would always be invalid to wrap it in a p tag.
As it can not contain any block level elements, we should only parse its content as span-level content.
Given the above, yes, summary should be added to the default list of block-level elements. It should also be added to the list of span_tags of the md_in_html extension to control the default behavior when it is given a markdown="1" attribute.
Activity
waylan commentedon Nov 30, 2020
Can you point to support for this in the HTML5 spec?
Sent with GitHawk
fiendish commentedon Dec 1, 2020
I don't understand the request. Support for what, the summary tag?
See: https://html.spec.whatwg.org/multipage/interactive-elements.html#the-summary-element
Also: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary
facelessuser commentedon Dec 1, 2020
summaryis being treated as inline from what I can tell. You can modify the elements treated as block in a plugin though, or you can modify the block elements of theMarkdowninstance directly: https://github.com/Python-Markdown/markdown/blob/master/markdown/core.py#L75. Now, could we treatsummaryas a block element by default? That is up to @waylan, but this can be worked around.Alternatively, you could consider using a plugin for details: https://facelessuser.github.io/pymdown-extensions/extensions/details/.
waylan commentedon Dec 1, 2020
Looking at the spec it seems that the
summarytag is only valid as the first child of adetailtag and can only contain elements which aptag can contain. Any other use would be invalid. Therefore...detail. If a document author uses it in that way that is on them. In other words we don't need to be concerned with using a different parsing behavior outside of the very limited valid use-case.pwould cause it to not be the first child ofdetailand therefore it would always be invalid to wrap it in aptag.Given the above, yes,
summaryshould be added to the default list of block-level elements. It should also be added to the list of span_tags of themd_in_htmlextension to control the default behavior when it is given amarkdown="1"attribute.Ensure <summary> tags are parsed correctly.
Ensure <summary> tags are parsed correctly.