Markdown中添加折叠段落(collapsible section)

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets

A collapsible section containing code

Click to expand!
  function whatIsLove() {
    console.log('Baby Don't hurt me. Don't hurt me');
    return 'No more';
  }

How to structure

# A collapsible section with markdown
<details>
  <summary>Click to expand!</summary>
  
  ## Heading
  1. A numbered
  2. list
     * With some
     * Sub bullets
</details>

NB: Make sure you have an empty line after the closing </summary> tag, otherwise the markdown/code blocks won't show correctly.

NB: Make sure you have an empty line after the closing </details> tag if you have multiple collapsible sections.


Cool! Any ideas how one could add code formating ? This doesn't work:

 Show `code`Still not code: ``` this is not code it should be code why can't it be code ```

dvdstelt commented on Sep 13, 2018  

Sure you can. Just remember to add a full empty line before the ```
Otherwise the codeblock doesn't properly start.

I could use some help...


I'll put the entire codeblock here, but because there are ''' inside it, I added one backslash (\) to the end, or otherwise formatting would be messed up. So remember to remove the backslash when copying this.

<details>
<summary>I could use some help...</summary>
<p>

```c#
public class Order
{
    public int OrderId { get; set; }
    public int CustomerId { get; set; }

    public List<int> Products { get; set; }
}
\```

</p>
</details>  





posted @ 2020-03-26 14:39  柠檬茶多放糖  阅读(1148)  评论(0编辑  收藏  举报