Here’s a template for inserting a Details tag into Jekyll kramdown. It allows you to use markdown syntax in both the summary and the body of the details tag.

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.