chains-markdown
This grunt task takes a set of markdown files and converts them to HTML. It supports GFM with code highlighting. The code highlighting is done using highlight.js.
Getting Started
Install this grunt plugin next to your project's grunt.js gruntfile with:
npm install grunt-markdown --save-dev
Then add this line to your gruntfile:
grunt;
Documentation
Creating a markdown task is simple. For the basic functionality add the following config in your gruntfile:
grunt;
Here is an example config using all of the options:
grunt;
These are the properties that the markdown
task accepts:
files
: This plugin supports use of the files API introduced in Grunt 0.4.1. Files may be specified using any one of the Compact Format, Files Objects Format, or Files Array Format (as in the above example).
Note: If you specify multiple files to one dest file, chains-markdown will concat all files and output to the dest file.
Options
Options passed directly to the markdown parser.
- pedantic: Conform to obscure parts of
markdown.pl
as much as possible. Don't fix any of the original markdown bugs or poor behavior. - gfm: Enable github flavored markdown (enabled by default).
- sanitize: Sanitize the output. Ignore any HTML that has been input.
- highlight: A callback to highlight code blocks.
- tables: Enable GFM tables. This is enabled by default. (Requires the
gfm
option in order to be enabled). - breaks: Enable GFM line breaks. Disabled by default.
- smartLists: Use smarter list behavior than the original markdown.
Disabled by default. May eventually be default with the old behavior
moved into
pedantic
. - smartypants: Use "smart" typograhic punctuation for things like quotes and dashes.
- langPrefix: Set the prefix for code block classes. Defaults to
lang-
.
Most markdown options are passed as-is to the marked markdown parser. The only option that is processed prior to compiling the markdown is the highlight
option. If you specify auto
or manual
the task will handle highlighting code blocks for you use highlight.js. If you pass a custom function as the highlight option it will be used to highlight the code.
auto
: Will try to detect the languagemanual
: will pass the language name from markdown to the highlight functioncodeLines
: specify text that should wrap code lines
License
Copyright (c) 2013 WangSai Licensed under the MIT license.