Code highlighting

97 views
Skip to first unread message

Edgaras

unread,
May 11, 2020, 8:59:56 AM5/11/20
to TiddlyWiki
Hey! I am using Prism.js for code highlighting, but I can't make it work.

The problem is that I use ``` markup around the code, that spits out <pre><code> around the code. But I also need to include <pre><code class="language-html"> (or other languages depending on a situation). 

Is there a way to specify extra attributes like classes to ```?

Thank you in advance!

Sylvain Naudin

unread,
May 11, 2020, 4:20:57 PM5/11/20
to TiddlyWiki
In TW we use highlight.js, and you can specify language by adding after ```, for example :

```css
 * { margin: 0; padding: 0; } /* micro reset */

html { font-size: 62.5%; }
body { font-size: 14px; font-size: 1.4rem; } /* =14px */
h1   { font-size: 24px; font-size: 2.4rem; } /* =24px */
```

See https://tiddlywiki.com/plugins/tiddlywiki/highlight/

And you can use css stylesheet to colorize the output.

Edgaras

unread,
May 12, 2020, 2:55:09 AM5/12/20
to TiddlyWiki
Thanks for the reply! I will try!
Reply all
Reply to author
Forward
0 new messages