2015-03-19 10:53:45 +00:00
title: $:/plugins/tiddlywiki/highlight/readme
2019-03-12 12:04:38 +00:00
This plugin provides syntax highlighting of code blocks using v9.15.6 of [[highlight.js|https://github.com/isagalaev/highlight.js]] from Ivan Sagalaev.
2015-09-11 18:53:06 +00:00
! Usage
When the plugin is installed it automatically applies highlighting to all codeblocks defined with triple backticks or with the CodeBlockWidget.
The language can optionally be specified after the opening triple braces:
<$codeblock code="""```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 */
```"""/>
If no language is specified highlight.js will attempt to automatically detect the language.
! Built-in Language Brushes
The plugin includes support for the following languages (referred to as "brushes" by highlight.js):
* apache
2019-03-12 12:04:38 +00:00
* arduino
* arm assembly
* asciidoc
* autohotkey
* awk
2015-09-11 18:53:06 +00:00
* bash
2019-03-12 12:04:38 +00:00
* cmake
2015-09-11 18:53:06 +00:00
* coffeescript
* cpp
* cs
* css
* diff
2019-03-12 12:04:38 +00:00
* dockerfile
* erlang
2019-11-20 09:51:00 +00:00
* elixir
2019-03-12 12:04:38 +00:00
* fortran
* go
* gradle
* haskell
* html
2015-09-11 18:53:06 +00:00
* http
* ini
2019-03-12 12:04:38 +00:00
* intel x86 assembly
2015-09-11 18:53:06 +00:00
* java
* javascript
* json
2019-03-12 12:04:38 +00:00
* kotlin
2015-09-11 18:53:06 +00:00
* makefile
* markdown
2019-03-12 12:04:38 +00:00
* mathematica
* matlab
2015-09-11 18:53:06 +00:00
* nginx
* objectivec
* perl
* php
2019-03-12 12:04:38 +00:00
* powershell
2015-09-11 18:53:06 +00:00
* python
2019-03-12 12:04:38 +00:00
* R
2015-09-11 18:53:06 +00:00
* ruby
2019-03-12 12:04:38 +00:00
* rust
2015-09-11 18:53:06 +00:00
* sql
2019-03-12 12:04:38 +00:00
* typescript
* vim script
2015-09-11 18:53:06 +00:00
* xml
2019-03-12 12:04:38 +00:00
* yaml
2015-03-19 10:53:45 +00:00
2016-08-18 08:07:06 +00:00
You can also specify the language as a MIME content type (eg `text/html` or `text/css`). The mapping is accomplished via mapping tiddlers whose titles start with `$:/config/HighlightPlugin/TypeMappings/`.