markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

MD033: Organizing information with collapsed sections

Open Obegg opened this issue 1 year ago • 7 comments

According to github docs: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections

I use:

<details><summary>
Example (Click to expand):
</summary>

But I get error:

MD033/no-inline-html: Inline HTML [Element: details]

What should I do?

Obegg avatar Apr 28 '24 19:04 Obegg

If you want to include inline HTML in your Markdown, you should disable the no-inline-html rule. The README shows multiple ways to do so.

DavidAnson avatar Apr 29 '24 02:04 DavidAnson

let's assume I don't want inline HTML - how do I get the same result (collapsed section)?

Obegg avatar Apr 29 '24 07:04 Obegg

I don't think the CommonMark specification (or GFM extensions) offers a way to do that.

DavidAnson avatar Apr 29 '24 16:04 DavidAnson

So if I understand correctly - this error can't be fixed since there's no way to create collapsed sections without using inline HTML,. If so - then I guess this extension need to add an exception whenever it detects inline HTML for collapsed sections such as <details> and <summery>

Obegg avatar Apr 29 '24 17:04 Obegg

There are many things that can be done in HTML that cannot be done in Markdown. If you want to do many of them, you can disable this rule. If you want to do some of them, you can customize the rule to allow the relevant elements: https://github.com/DavidAnson/markdownlint/blob/main/doc/md033.md

DavidAnson avatar Apr 29 '24 22:04 DavidAnson

But it should not be custom specifically for me, it should be added globally, I'm not the only one who uses this extension and has collapsed sections.

Obegg avatar Apr 29 '24 22:04 Obegg

The rule exists to block HTML and keep Markdown content pure - for people who want that. The specific scenario raised above does not seem to be more special than any other. In fact, this issue may be the first time it has come up.

DavidAnson avatar Apr 30 '24 06:04 DavidAnson