Skip to content

Treat <details> as an HTML block in Markdown - #1888

Open
sourya2704 wants to merge 1 commit into
ruby:masterfrom
sourya2704:markdown-details-html-block
Open

sourya2704 wants to merge 1 commit into
ruby:masterfrom
sourya2704:markdown-details-html-block

Conversation

@sourya2704

Copy link
Copy Markdown

Refs #1287

In a Markdown file, a <details> element is escaped and shows up as text:

<details>
<summary>More</summary>

Hidden text.

</details>

renders as

<p>&lt;details&gt; &lt;summary&gt;More&lt;/summary&gt;</p>
<p>Hidden text.</p>
<p>&lt;/details&gt;</p>

while the same thing with <div> is passed through. The grammar's HtmlBlockInTags only lists the HTML 4 block elements. This adds details to it the same way as div (nesting included), and regenerates markdown.rb with rake generate.

As with <div>, the content inside the block is kept as raw HTML, so bold or code inside it needs <b>/<code> for now. The .rdoc markup format is unchanged; this only covers the Markdown side of #1287.

The Markdown grammar only knew the HTML 4 block elements, so a
<details> element was parsed as paragraph text and escaped. Add it to
HtmlBlockInTags like <div>, so it is passed through as raw HTML.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant