Here’s a template for inserting an html <details> tag into markdown. It allows markdown syntax inside the summary and the body of a <details> tag. This works with Jekyll’s Kramdown dialect of markdown, served by GitHub Pages.

SUMMARY

DETAILS

Markdown template

Copy and paste these four lines into your markdown document.


{% capture summary %}SUMMARY{% endcapture %}  
{% capture details %}  
DETAILS  
{% endcapture %}{% include details.html %} 

Replace SUMMARY and DETAILS with your content.

.html include file

The last line of the template references a file: _includes/details.html. Create a file with this code and put it in your _includes folder.


<details>
    <summary>{{ summary | markdownify | remove: '<p>' | remove: '</p>' }}</summary>
    {{ details | markdownify }}
</details>

Example

show the answer

$\text R_\text T = \text R_\text N = 500\,\Omega$

$\text V_{\text T} = \text V_{\text T} \, \text R_{\text N} = 0.002 \cdot 500 = 1\,\text V$

Resistor and voltage source schematic

The markdown source file for this article is in _articles/details.md.