kramdown Markdown parser, for use with RubyMotion on iOS and macOS.
Currently implements: kramdown 1.16.2
kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and supporting several common extensions.
The syntax definition for the kramdown syntax can be found online at http://kramdown.gettalong.org/syntax.html and a quick reference is available online at http://kramdown.gettalong.org/quickref.html.
The kramdown library is mainly written to support the kramdown-to-HTML conversion chain. However, due to its flexibility (by creating an internal AST) it supports other input and output formats as well. Here is a list of the supported formats:
- input formats: kramdown (a Markdown superset), Markdown, GFM, HTML
- output formats: HTML, kramdown (and LaTeX and PDF, though not in motion-kramdown)
All the documentation on the available input and output formats is available online at http://kramdown.gettalong.org.
Add it to your project's Gemfile
gem 'motion-kramdown'
Edit your Rakefile
and add
require 'motion-kramdown'
motion-kramdown uses the same api and options as kramdown
Kramdown::Document.new(text).to_html
For detailed information on usage and options, see the kramdown documentation. The full kramdown RDoc documentation is available at http://kramdown.gettalong.org/rdoc/
The entire kramdown api is supported, except where noted below.
These items are currently not supported
- transliterated header ids
- math engines: MathJax, Ritex, and itex2MML
- syntax highlighters: Coderay and Rouge
- Latex
- using template files or the :template option
- Andriod support (will accept pull requests)
Test files are located in the spec
directory. The test
directory contains the original kramdown test and data files, which are used in the specs.
#--- run the entire test suite
rake spec
#--- run just the kramdown converter tests
rake spec files=kramdown_to_xxx
#--- run test for specific data files
rake spec files=kramdown_to_xxx focus=block/03_paragraph
If you run into any problems with the gem,
- First see if the problem exists with the regular kramdown gem. If it does, then the issue should be opened on the main kramdown repository
- Open an issue on this repository
All credit for kramdown belongs to Thomas Leitner. motion-kramdown is a simple modifcation to make it work with RubyMotion.
motion-kramdown is released under the MIT license (see the COPYING file) and therefore can easily be used in commercial projects.
However, if you use motion-kramdown in a commercial setting, please consider contributing back any changes for the benefit of the community and/or becoming a patron - thanks!