From b094b933011e314ac24bd62d5563d5286783918c Mon Sep 17 00:00:00 2001 From: Mark Reid Date: Mon, 15 Dec 2008 16:17:45 +1100 Subject: [PATCH] Replaced rdiscount with Maruku for Markdown with equation support --- README.textile | 11 +++++++++-- Rakefile | 2 +- TODO | 1 + jekyll.gemspec | 6 +++--- lib/jekyll.rb | 15 +++++++++++++-- lib/jekyll/convertible.rb | 2 +- 6 files changed, 28 insertions(+), 9 deletions(-) diff --git a/README.textile b/README.textile index e5bfd3285de..75064b9395b 100644 --- a/README.textile +++ b/README.textile @@ -80,8 +80,15 @@ The best way to install Jekyll is via RubyGems: $ sudo gem install mojombo-jekyll -s http://gems.github.com/ Jekyll requires the gems `directory_watcher`, `liquid`, `open4`, -and optionally `rdiscount` for markdown support. These are automatically -installed by the gem install. +and `maruku` for markdown support. These are automatically +installed by the gem install command. + +Maruku comes with optional support for LaTeX to PNG rendering via +"blahtex":http://gva.noekeon.org/blahtexml/ (Version 0.6) which must be in +your $PATH along with `dvips`. + +(NOTE: the version of maruku I am using is `remi-maruku` on GitHub as it +does not assume a fixed location for `dvips`.) h2. Run diff --git a/Rakefile b/Rakefile index 19a79501a41..3241e993518 100644 --- a/Rakefile +++ b/Rakefile @@ -5,7 +5,7 @@ require 'lib/jekyll' Hoe.new('jekyll', Jekyll::VERSION) do |p| p.developer('Tom Preston-Werner', 'tom@mojombo.com') p.summary = "Jekyll is a simple, blog aware, static site generator." - p.extra_deps = ['RedCloth', 'liquid', 'classifier', 'rdiscount', 'directory_watcher', 'open4'] + p.extra_deps = ['RedCloth', 'liquid', 'classifier', 'maruku', 'directory_watcher', 'open4'] end desc "Open an irb session preloaded with this library" diff --git a/TODO b/TODO index e85f4c4479e..4ca398c6cbb 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,3 @@ +[ ] Easier configuration of Maruka and blahtex directories [mdreid] [ ] Accurate "related posts" calculator [ ] Autobuild \ No newline at end of file diff --git a/jekyll.gemspec b/jekyll.gemspec index 61258d718da..9b75d2693bf 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 1.8.0"]) @@ -34,7 +34,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 1.8.0"]) @@ -43,7 +43,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 1.8.0"]) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 2ab53cff0ef..e23382e11f6 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -13,9 +13,20 @@ require 'liquid' require 'redcloth' begin - require 'rdiscount' + require 'maruku' + require 'maruku/ext/math' + # 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] = 'blahtex' + MaRuKu::Globals[:html_png_dir] = 'images/latex' + MaRuKu::Globals[:html_png_url] = '/images/latex/' rescue LoadError - puts "The rdiscount gem is required for markdown support!" + puts "The maruku gem is required for markdown support!" end require 'directory_watcher' diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index a174061173a..08bce9a333a 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -30,7 +30,7 @@ def transform self.content = RedCloth.new(self.content).to_html when ".markdown": self.ext = ".html" - self.content = RDiscount.new(self.content).to_html + self.content = Maruku.new(self.content).to_html end end