remark-gfm:
collapse is not supported

<details> not supported

Using of <details> tags in GFM is supposed to create collapse sections. By default this is not happening in react-markdown when gfm is added as a plugin, and I see no option to enable it.

Your environment

  • OS: MacOS
  • Packages: React-markdown

Steps to reproduce

  1. Add this section to markdown
<details>
<summary> Title</summary>

Main Section
</details>
  1. Add remark-gfm as react-markdown plugin

Codesandbox reproduction

Expected behavior

A collapsible should replace the <details> section

Actual behavior

<details content is rendered as escaped string.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (11 by maintainers)

Most upvoted comments

Showing me that CommonMark behaves differently that GitHub only proves that this isn’t part of CommonMark

He’s showing the it behaves the same as GFM.

GitHub has chosen to give special behavior to a subset of HTML that includes <details>. That’s the delta between GitHub (not CommonMark, GFM) and this package that is at issue.

You’re missing a key point here. CommonMark, GFM, and most markdown flavors embed HTML. HTML fragments are different document(s), included inside the Markdown documents.

Markdown parsers will split the content into embeddings, here as a raw html node. But how to handle the HTML itself is outside of what Markdown does.

For an analogy, think for HTML and SVG, SVG documents can be put in HTML pages, but they aren’t HTML. When HTML sees something SVG like, it hands off to the SVG engine to do the rest.

Here the same concept applies, Markdown sees something HTML like, and it can (optionally) hand it off to an HTML engine to do additional processing.