Plugin for show more code block

Hi folks,
I want to include code blocks into my blogs posts, this is all working fine, but some of the code blocks can be quite long, is there a way of limiting the number of lines shown with with a display more/expand functionality?

1 Like

Hi Gabriel.

Indeed there is a way! In short, here is how to do it:

<details>
<summary>
Preview
</summary>

{% highlight ruby %}
puts 'Expanded message'
{% endhighlight %}

</details>

Here is my cheatsheet doc covering that in more detail - I added a Jekyll section to explain and demo this in more detail.

cheatsheets/markdown.md#collapsible-items

2 Likes

Hi Michael. Your link is 404 but here is one I just read that works: Collapsible items | Dev Cheatsheets

Also github gist has other tips: https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab

Thanks for fixing that - the link you gave is correct now.

And thanks for the gist.