Add docs about custom markdown processor
This commit is contained in:
parent
2f660674c3
commit
581b07d096
|
@ -14,7 +14,7 @@ Jam-packed with some [highly-requested features and bugfixes galore][changelog],
|
|||
2. [Brand new site template](https://github.com/jekyll/jekyll/pull/2050#issuecomment-35938016) (thanks [@jglovier][]!) - Getting started with Jekyll just got a lot easier and a lot more beautiful. Just run `jekyll new <path>` and you're good to go.
|
||||
3. [Native Sass & CoffeeScript support](/docs/assets/) - We love CSS and JavaScript as much as the next guy, but there will always be a special place in our hearts for Sass and CoffeeScript. We now offer native support for these file types — no more messing around with Rake or Grunt!
|
||||
4. [YAML Front-Matter defaults](/docs/configuration/#frontmatter_defaults) - If you've set `layout: post` more than once in your life, you'll love this new feature: set front-matter defaults for a given directory or type.
|
||||
5. [Custom markdown processors](/docs/configuration/#custom_markdown_processors) - Always wanted to use your favourite home-grown Markdown converter, but couldn't with Jekyll? Now you can. Simply specify `markdown: MyConverterClass` and you're on your way.
|
||||
5. [Custom markdown processors](/docs/configuration/#custom-markdown-processors) - Always wanted to use your favourite home-grown Markdown converter, but couldn't with Jekyll? Now you can. Simply specify `markdown: MyConverterClass` and you're on your way.
|
||||
6. [Addition of `where` and `group_by` Liquid filters](/docs/templates/#filters) - Simplifying your Liquid templates one filter at a time. The `where` filter selects from an array all items within which have a given value for a property. The `group_by` filter groups all items in an array which have the same value for a given property.
|
||||
7. [Switch from Maruku to Kramdown as default markdown converter](https://github.com/jekyll/jekyll/pull/1988) - Maruku is dead. We've replaced it with the converter which has the closest feature parity: Kramdown!
|
||||
|
||||
|
|
|
@ -454,3 +454,30 @@ For example, in your `_config.yml`:
|
|||
|
||||
kramdown:
|
||||
input: GFM
|
||||
|
||||
### Custom Markdown Processors
|
||||
|
||||
If you're interested in creating a custom markdown processor, you're in luck! Create a new class in the `Jekyll::Converters::Markdown` namespace:
|
||||
|
||||
{% highlight ruby %}
|
||||
class Jekyll::Converters::Markdown::MyCustomProcessor
|
||||
def initialize(config)
|
||||
require 'funky_markdown'
|
||||
@config = config
|
||||
rescue LoadError
|
||||
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||
STDERR.puts ' $ [sudo] gem install funky_markdown'
|
||||
raise FatalException.new("Missing dependency: funky_markdown")
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
::FunkyMarkdown.new(content).convert
|
||||
end
|
||||
end
|
||||
{% endhighlight %}
|
||||
|
||||
Once you've created your class and have it properly setup either as a plugin in the `_plugins` folder or as a gem, specify it in your `_config.yml`:
|
||||
|
||||
{% highlight yaml %}
|
||||
markdown: MyCustomProcessor
|
||||
{% endhighlight %}
|
||||
|
|
Loading…
Reference in New Issue