Search
Site Essentials for Statamic

Site Essentials for Statamic

se_cm_to_hljs Modifier

The se_cm_to_hljs modifier can be used to convert a Code Mirror language identifier to a Highlight.js language identifier. The target scenario is using Statamic's Code fieldtype in the Control Panel, and using Highlight.js to provide syntax highlighting on the front-end.

1{{ code_field_handle }}
2<pre class="{{ mode | se_cm_to_hljs /}}">
3 <code>{{ code | entities /}}</code>
4</pre>
5{{ /code_field_handle }}

#Default Language Mappings

The se_cm_to_hljs modifier will remap the following languages:

Mode

Highlight.js Language

htmlmixed

html

javascript

js

clike

cpp

shell

bash

sass

scss

markdown

md

vb

vbnet

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.