Posts tagged "markdown"

Collapsible Markdown

When presenting code or logs in Markdown, things tend to get out of hand quickly.
The <details> and <summary> HTML tags can be used to mitigate this, which hide certain parts of your document.
Be aware that Markdown specific syntax constructs within those HTML tags are only guaranteed to be rendered correctly by CommonMark and / or GFM compliant parsers (for example the GitHub Markdown parser).

<details>
	<summary>Click to expand this section!</summary>
	<h5>A nice Javascript pitfall!</h5>

	```javascript
	console.log(['1', '7', '11'].map(parseInt));
	```
</details>

This Markdown snippet creates the following result:

Click to expand this section!
A nice Javascript pitfall!
console.log(['1', '7', '11'].map(parseInt));