Skip to content

Update docs for "Organizing information with collapsed sections" to include GitHub Pages support #32988

@jrzyshr

Description

@jrzyshr

Code of Conduct

What article on docs.github.com is affected?

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

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:

  1. Create a Markdown file with the content from the sample snippet from this page in the docs
  2. Enable GH Pages to render a site from the branch where your Markdown file is.
  3. View the corresponding HTML page in the GH Pages site.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SME reviewedAn SME has reviewed this issue/PRcontentThis issue or pull request belongs to the Docs Content teamget startedContent related to "Getting Started" doc set

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions