TiddlyWiki5/plugins/tiddlywiki/highlight
dnebauer dc74fc4306 Update url of highlight.js github project (#3672)
Github repo of the highlight.js project has changed from `github.com/isagalaev/highlight.js` to `github.com/highlightjs/highlight.js`.
2019-01-14 09:31:29 +00:00
..
files
TypeMappings.multids
highlightblock.js
license.tid
plugin.info
readme.tid Update url of highlight.js github project (#3672) 2019-01-14 09:31:29 +00:00
styles.tid
usage.tid Revert "Add text/vnd.tiddlywiki to system tiddlers within plugins that should be wikified (c.f. #2883)" 2017-06-24 17:48:32 +01:00

readme.tid

title: $:/plugins/tiddlywiki/highlight/readme

This plugin provides syntax highlighting of code blocks using v8.8.0 of [[highlight.js|https://github.com/highlightjs/highlight.js]] from Ivan Sagalaev and others.

! 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
* bash
* coffeescript
* cpp
* cs
* css
* diff
* http
* ini
* java
* javascript
* json
* makefile
* markdown
* nginx
* objectivec
* perl
* php
* python
* ruby
* sql
* xml

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/`.