Class: Jekyll::Converters::Markdown::MarukuParser

### Home Classes Methods

### In Files

- lib/jekyll/converters/markdown/maruku_parser.rb

### Parent

Object

### Methods

- ::new
- #convert
- #load_blahtext_library
- #load_divs_library
- #print_errors_and_fail

### Files

- LICENSE

### Class/Module Index

Quicksearch

- Jekyll
- Jekyll::Command
- Jekyll::Commands
- Jekyll::Commands::Build
- Jekyll::Commands::Doctor
- Jekyll::Commands::New
- Jekyll::Commands::Serve
- Jekyll::Configuration
- Jekyll::Converter
- Jekyll::Converters
- Jekyll::Converters::Identity
- Jekyll::Converters::Markdown
- Jekyll::Converters::Markdown::KramdownParser
- Jekyll::Converters::Markdown::MarukuParser
- Jekyll::Converters::Markdown::RDiscountParser
- Jekyll::Converters::Markdown::RedcarpetParser
- Jekyll::Converters::Markdown::RedcarpetParser::CommonMethods
- Jekyll::Converters::Markdown::RedcarpetParser::WithPygments
- Jekyll::Converters::Markdown::RedcarpetParser::WithoutPygments
- Jekyll::Converters::Textile
- Jekyll::Convertible
- Jekyll::Deprecator
- Jekyll::Draft
- Jekyll::Excerpt
- Jekyll::FatalException
- Jekyll::Filters
- Jekyll::Generator
- Jekyll::Generators
- Jekyll::Generators::Pagination
- Jekyll::GistTag
- Jekyll::Layout
- Jekyll::Page
- Jekyll::Pager
- Jekyll::Plugin
- Jekyll::Post
- Jekyll::RelatedPosts
- Jekyll::Site
- Jekyll::Site::Cleaner
- Jekyll::StaticFile
- Jekyll::Stevenson
- Jekyll::Tags
- Jekyll::Tags::HighlightBlock
- Jekyll::Tags::IncludeTag
- Jekyll::Tags::PostComparer
- Jekyll::Tags::PostUrl
- Jekyll::URL
- Date
- Enumerable
- Hash
- Object

No matching classes.

# Jekyll::Converters::Markdown::MarukuParser

### Public Class Methods

new(config) click to toggle source

    # File lib/jekyll/converters/markdown/maruku_parser.rb, line 5
    def initialize(config)
      require 'maruku'
      @config = config
      @errors = []
      load_divs_library if @config['maruku']['use_divs']
      load_blahtext_library if @config['maruku']['use_tex']
    rescue LoadError
      STDERR.puts 'You are missing a library required for Markdown. Please run:'
      STDERR.puts '  $ [sudo] gem install maruku'
      raise FatalException.new("Missing dependency: maruku")
    end

### Public Instance Methods

convert(content) click to toggle source

    # File lib/jekyll/converters/markdown/maruku_parser.rb, line 43
    def convert(content)
      converted = Maruku.new(content, :error_stream => @errors).to_html
      print_errors_and_fail unless @errors.empty?
      converted
    end

load_blahtext_library() click to toggle source

    # File lib/jekyll/converters/markdown/maruku_parser.rb, line 22
    def load_blahtext_library
      require 'maruku/ext/math'
      STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`."

      # Switch off MathML output
      MaRuKu::Globals[:html_math_output_mathml] = false
      MaRuKu::Globals[:html_math_engine] = 'none'

      # Turn on math to PNG support with blahtex
      # Resulting PNGs stored in `images/latex`
      MaRuKu::Globals[:html_math_output_png] = true
      MaRuKu::Globals[:html_png_engine] =  @config['maruku']['png_engine']
      MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir']
      MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
    end

load_divs_library() click to toggle source

    # File lib/jekyll/converters/markdown/maruku_parser.rb, line 17
    def load_divs_library
      require 'maruku/ext/div'
      STDERR.puts 'Maruku: Using extended syntax for div elements.'
    end

print_errors_and_fail() click to toggle source

    # File lib/jekyll/converters/markdown/maruku_parser.rb, line 38
    def print_errors_and_fail
      print @errors.join
      raise MaRuKu::Exception, "MaRuKu encountered problem(s) while converting your markup."
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.