# Darkmouun ## Overview Darkmouun is the converter from a markdown text enhanced by [kramdown](https://github.com/gettalong/kramdown) to a HTML document. Darkmouun can define: * Pre-processing (to a markdown document) * Extracting templates by Mustache * Converting from markdown to HTML by kramdown * Post-processing (to a HTML document) ## Installation Add this line to your application's Gemfile: ```ruby gem 'darkmouun' ``` And then execute: $ bundle Or install it yourself as: $ gem install darkmouun ## Usage Darkmouun instance is made by `Darkmouun.document.new` with no arguments. (Darkmouun instance)`.convert` makes a HTML document from the markdown text and takes 3 arguments. * 1st arg: Markdown text (String) * 2nd arg: Kramdown's parser option (Hash) (cf. [kramdown's usage](https://kramdown.gettalong.org/documentation.html#usage)) * 3rd arg: Kramdown's converter name (Symbol) 2nd and 3rd argument have default values. * 2nd arg: `{}` * 3rd arg: `:to_html` You can define pre_process and post_process as Proc object. ``` dkmn = Darkmouun.document.new dkmn.pre_process = lambda do |i| i.gsub!(/MARKDOWN/, "Markdown") end dkmn.post_process = lambda do |i| i.gsub!(/DOCUMENT/, "Document") end dkmn.convert("MARKDOWN DOCUMENT") #=> "
Markdown Document
``` You can write the parts that Mustache extracts with templates in your markdown document. Template is written as Ruby script, and it is made to define as the subclass of Mustache class. The part of template extacting in the markdown document starts `<The Calculation:
#=>1 + 2 is 3.
``` ## kramdown extensions Darkmouun has extended to kramdown. Extensions are below; 1. **Plain span element form.** `[spanned phrase]` is converted to `spanned phrase`.