1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00
TiddlyWiki5/plugins/tiddlywiki/highlight
Jermolene ee9d19d299 Fix problem with highlight plugin language brushes
TiddlyWiki passes the MIME type of the tiddler to highlight.js as the
"language brush", but it turns out that highlight.js doesn't actually
understand MIME types. This commit introduces a configuration mapping
between common MIME types and highlight.js language brushes

Fixes #2535
2016-08-18 09:07:06 +01:00
..
files Update to v8.8.0 of highlight.js 2015-09-11 19:53:06 +01:00
highlightblock.js Fix problem with highlight plugin language brushes 2016-08-18 09:07:06 +01:00
license.tid in resp to https://github.com/Jermolene/TiddlyWiki5/pull/328#issuecomment-32131402 2014-01-12 21:48:03 +00:00
plugin.info Improve plugin readmes 2015-03-19 10:53:45 +00:00
readme.tid Fix problem with highlight plugin language brushes 2016-08-18 09:07:06 +01:00
styles.tid Revert to a pale default theme for highlight plugin 2015-04-17 16:05:54 +01:00
TypeMappings.multids Fix problem with highlight plugin language brushes 2016-08-18 09:07:06 +01:00
usage.tid Improve plugin readmes 2015-03-19 10:53:45 +00:00

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

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

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