Adds support for Highlight.js syntax highlighting to DocPad
npm install docpad-plugin-highlightjs
This plugin enables Highlight.js syntax highlighting for DocPad
```
docpad install highlightjs
Available stylesheets are here. You can preview some of them here.
Example inputs are here and their corresponding outputs are here. For the general gist of things, the following will suffice:
#### Input
` htmlCoffescript - Lang tag
if true
func = ->
alert "hello world"
func()
`
#### Output
` htmlCoffescript - Lang tag
if true
func = ->
alert "hello world"
func()
`
#### Input
### Coffeescript with fenced code
` coffeescript`
if true
func = ->
alert 'hello world'
func()
#### Output
` html`Coffeescript with fenced code
if true
func = ->
alert 'hello world'
func()
` coffee`
plugins:
highlightjs:
aliases:
missinglanguage: 'alternativelanguage'
You can find a list of languages that are supported via the Highlight.js source tree.
configuration option:` coffee
plugins:
highlightjs:
replaceTab: null # keep tabs
`
$3
You can apply transformations to code blocks before they are highlighted by using the
transforms configuration option. It accepts an array of functions or arrays.` coffee
plugins:
highlightjs:
transforms: [
# Remove extra indentation from the code block
# Requires: http://balupton.com/project/bal-util
(source, language) ->
require('bal-util').removeIndentation(source) if language in ['bash','coffeescript'] # Replace "(C)" with "©"
(source) -> source.replace /\(C\)/gm, '©'
]
`$3
You can customise the css classname that is added by adjusting the
className configuration option, defaults to highlight` coffee
plugins:
highlightjs:
className: 'blah'
``Discover the release history by heading on over to the HISTORY.md file.
Discover how you can contribute by heading on over to the CONTRIBUTING.md file.
These amazing people are maintaining this project:
No sponsors yet! Will you be the first?
These amazing people have contributed code to this project:
Discover how you can contribute by heading on over to the CONTRIBUTING.md file.
Unless stated otherwise all works are:
and licensed under: