diff --git a/.travis.yml b/.travis.yml index a3e749f776..2620251661 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,9 @@ addons: - ubuntu-toolchain-r-test packages: - g++-4.8 - + homebrew: + packages: + - pandoc rvm: - 2.2.10 - 2.3.8 diff --git a/Gemfile b/Gemfile index 13bee90de0..af675416d6 100644 --- a/Gemfile +++ b/Gemfile @@ -59,6 +59,7 @@ if RUBY_ENGINE == "ruby" gem 'sass' gem 'reel-rack' gem 'celluloid', '~> 0.16.0' + gem 'pandoc-ruby', '~> 2.0.2' gem 'simplecov', require: false end diff --git a/README.md b/README.md index 336ac2b994..effb719297 100644 --- a/README.md +++ b/README.md @@ -750,6 +750,8 @@ template, you almost always want to pass locals to it. BlueCloth, kramdown, maruku + commonmarker + pandoc diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index d9c3164a1e..312764ada5 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -722,6 +722,7 @@ def liquid(template, options = {}, locals = {}, &block) end def markdown(template, options = {}, locals = {}) + options[:default_outvar] = false render :markdown, template, options, locals end @@ -825,10 +826,11 @@ def render(engine, data, options = {}, locals = {}, &block) content_type = options.delete(:content_type) || content_type layout_engine = options.delete(:layout_engine) || engine scope = options.delete(:scope) || self + default_outvar = options.delete(:default_outvar) != false options.delete(:layout) # set some defaults - options[:outvar] ||= '@_out_buf' + options[:outvar] ||= '@_out_buf' if default_outvar options[:default_encoding] ||= settings.default_encoding # compile and render template