Markdown Highlight Extended Filter for HTML::Pipeline
An HTML::Pipeline filter to convert Octopress-flavored syntax highlighting, like this:
``` [language] [title] [url] [link text]
code snippet
```
See: http://octopress.org/docs/blogging/code/
Installation
Add this line to your application's Gemfile:
gem 'markdown-highlight-extended-filter'
And then execute:
$ bundle
Or install it without Gemfile (like, Jekyll project):
$ gem install markdown-highlight-extended-filter
Usage
pipeline = HTML::Pipeline.new [
MarkdownHighlightExtendedFilter,
HTML::Pipeline::MarkdownFilter
]
pipeline.call(File.read("example.md"))[:output]
example.md:
Here is a sample:
```ruby test.rb
def abc
123
end
```
Jekyll site usage
This filter is for HTML::Pipeline, so you must use HTML::Pipeline to
generate your content from Markdown. See gjtorikian/jekyll-html-pipeline for more details.
Edit _config.yml
and configure the pieline like this:
gems:
- jekyll-html-pipeline
- markdown-highlight-extended-filter
markdown: HTMLPipeline
html_pipeline:
filters:
- "MarkdownHighlightExtendedFilter"
- "markdownfilter"
Known Issues
Unsupported features:
- Line Numbers
- Line Highlights
These were defined in Octopress's document as additional options. (PR welcome!)
Special Thanks
The code to convert complex syntax highlighting was stolen from Octopress Project.
See imathis/octopress:plugins/backtick_code_block.rb@73e5404 for the original source code. Also thanks contributers: @imathis, @fhemberger and @liangsun. I hope you don't mind :D
Contributing
- Fork it ( https://github.com/chitsaou/markdown-highlight-extended-filter/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request