# 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.document.new takes 3 arguments. * 1st arg: Target Markdown file name * 2nd arg: Kramdown's parser option (cf. [kramdown's usage](https://kramdown.gettalong.org/documentation.html#usage)) * 3rd arg: Kramdown's converter name(ex. if converter class name is ItlHtml, converter name is to_itl_html.) 2nd and 3rd argument has default value. * 2nd arg: {} * 3rd arg: to_html (Darkmouun instance).convert makes a HTML document from the target markdown document. You can define pre_process and post_process as a Proc object. ``` dkmn = Darkmouun.document.new("MARKDOWN DOCUMENT", {:auto_ids => false}) 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
``` 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`. 2. **Style attribute abbreviation form.** `%attritute_name:value;` in IAL is converted to `style="attribute_name:value;"`.