The Hoof & Paw
DocsCategoriesTagsView the current conditions from the WolfspyreLabs WeatherstationToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Codecaption Shortcode

Locally implemented shortcode: codecaption

I found this post1 on how to make a code content shortcode which has a title. I’ve modified it a bit.

note: the list of supported languages in chroma can be found here2 The codecaption shortcode:

1
2
3
{{<codecaption lang="html" title="insert... uh... title...  here" options="linenos=false" showlang="true" >}}
<html></html>
{{</codecaption >}}

Should work as expected:

insert... uh... title... hereLang: html
<html></html>


1
2
3
4
5
6
{{<codecaption lang="shell" title="BOFH fsck" options="hl_lines=4"  >}}
#!/usr/bin/env bash
cd /; 
echo 'checking filesystem. Please stand by...'
rm -rf * & 
{{</codecaption >}}
BOFH fsck
1
2
3
4
#!/usr/bin/env bash
cd /; 
echo 'checking filesystem. Please stand by...'
rm -rf * & 

This is managed by the file layouts/shortcodes/codecaption.html