Add docs for custom markdown processors.
This commit is contained in:
parent
ab95cca434
commit
88612bf7ce
|
@ -16,7 +16,12 @@ Maruku comes with optional support for LaTeX to PNG rendering via blahtex
|
||||||
Maruku to not assume a fixed location for `dvips`, check out [Remi’s Maruku
|
Maruku to not assume a fixed location for `dvips`, check out [Remi’s Maruku
|
||||||
fork](http://github.com/remi/maruku).
|
fork](http://github.com/remi/maruku).
|
||||||
|
|
||||||
## RDiscount
|
## Alternative Markdown Processors
|
||||||
|
|
||||||
|
While Jekyll defaults to using Maruku for Markdown conversion, you may use one
|
||||||
|
of the other three pre-defined markdown parsers or define your own.
|
||||||
|
|
||||||
|
### RDiscount
|
||||||
|
|
||||||
If you prefer to use [RDiscount](http://github.com/rtomayko/rdiscount) instead
|
If you prefer to use [RDiscount](http://github.com/rtomayko/rdiscount) instead
|
||||||
of [Maruku](http://github.com/bhollis/maruku) for Markdown, just make sure you have
|
of [Maruku](http://github.com/bhollis/maruku) for Markdown, just make sure you have
|
||||||
|
@ -34,7 +39,7 @@ have Jekyll run with that option.
|
||||||
markdown: rdiscount
|
markdown: rdiscount
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
## Kramdown
|
### Kramdown
|
||||||
|
|
||||||
You can also use [Kramdown](http://kramdown.rubyforge.org/) instead of Maruku
|
You can also use [Kramdown](http://kramdown.rubyforge.org/) instead of Maruku
|
||||||
for Markdown. Make sure that Kramdown is installed:
|
for Markdown. Make sure that Kramdown is installed:
|
||||||
|
@ -54,3 +59,34 @@ Kramdown has various options for customizing the HTML output. The
|
||||||
[Configuration](/docs/configuration/) page lists the default options used by
|
[Configuration](/docs/configuration/) page lists the default options used by
|
||||||
Jekyll. A complete list of options is also available on the [Kramdown
|
Jekyll. A complete list of options is also available on the [Kramdown
|
||||||
website](http://kramdown.rubyforge.org/options.html).
|
website](http://kramdown.rubyforge.org/options.html).
|
||||||
|
|
||||||
|
### User-Defined
|
||||||
|
|
||||||
|
So, you're totally at odds with our four built-in markdown parsers, eh? No
|
||||||
|
sweat. You can define one as a plugin:
|
||||||
|
|
||||||
|
{% highlight ruby %}
|
||||||
|
require 'jekyll'
|
||||||
|
require 'some_renderer'
|
||||||
|
|
||||||
|
class Jekyll::Converters::Markdown::MyCustomParser
|
||||||
|
def initialize(config)
|
||||||
|
@site_config = config
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert(content)
|
||||||
|
# (this _must_ return the resulting String after the rendering)
|
||||||
|
SomeRenderer.new(@site_config).to_html(content)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
|
Once you've got that setup, ask Jekyll to use your custom markdown parser in
|
||||||
|
your `_config.yml` file:
|
||||||
|
|
||||||
|
{% highlight yaml %}
|
||||||
|
markdown: MyCustomParser
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
|
(Note that this **is case-sensitive**, and is only the piece after
|
||||||
|
`Jekyll::Converters::Markdown`.) And there you are!
|
||||||
|
|
Loading…
Reference in New Issue