-
Notifications
You must be signed in to change notification settings - Fork 65.9k
Description
Code of Conduct
- I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
What part(s) of the article would you like to see updated?
The sample Markdown displayed in the article will fail to render properly on a GitHub Pages website generated with Jekyll:
<details>
<summary>Tips for collapsed sections</summary>
### You can add a header
You can add text within a collapsed section.
You can add an image or a code block, too.
```ruby
puts "Hello World"
```
</details>Problem: This Markdown will result in the Jekyll renderer (Kramdown or GHMarkdown) treating all content in the Markdown file after the first <summary/> tag being rendered as plain text. The webpage will hide the plain text in a collapsible section. If the user clicks on the text in the <summary> tag on the GH Pages webpage, it will expand revealing the plain text from the source Markdown file in the GitHub repo.
Solution: Adding a markdown="1" attribute to the <details> tag and a markdown="span" attribute to the <summary> tag will solve this issue.
I discovered the solution in this issue from the Kramdown repo: gettalong/kramdown#155 (comment)
I propose either the sample in the document be updated as per the block below, OR a note added afterwards calling out this scenario when GH Pages is used with your Markdown.
<details markdown="1">
<summary markdown="span">Tips for collapsed sections</summary>
### You can add a header
You can add text within a collapsed section.
You can add an image or a code block, too.
```ruby
puts "Hello World"
```
</details>Additional information
To reproduce the issue:
- Create a Markdown file with the content from the sample snippet from this page in the docs
- Enable GH Pages to render a site from the branch where your Markdown file is.
- View the corresponding HTML page in the GH Pages site.