# pandoc-ruby **Repository Path**: mirrors_xwmx/pandoc-ruby ## Basic Information - **Project Name**: pandoc-ruby - **Description**: Ruby wrapper for Pandoc - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-01-06 - **Last Updated**: 2026-02-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PandocRuby [](https://github.com/xwmx/pandoc-ruby/actions) [](http://rubygems.org/gems/pandoc-ruby) [](http://rubygems.org/gems/pandoc-ruby) PandocRuby is a wrapper for [Pandoc](http://pandoc.org), a Haskell library with command line tools for converting one markup format to another. Pandoc can convert documents from a variety of formats including markdown, reStructuredText, textile, HTML, DocBook, LaTeX, and MediaWiki markup to a variety of other formats, including markdown, reStructuredText, HTML, LaTeX, ConTeXt, PDF, RTF, DocBook XML, OpenDocument XML, ODT, GNU Texinfo, MediaWiki markup, groff man pages, HTML slide shows, EPUB, Microsoft Word docx, and more. ## Installation First, [install Pandoc](https://pandoc.org/installing.html). PandocRuby is available on [RubyGems](http://rubygems.org/gems/pandoc-ruby): ```bash gem install pandoc-ruby ``` To install with [Bundler](https://bundler.io/), add the following to your Gemfile: ```ruby gem 'pandoc-ruby' ``` Then run `bundle install` ## Usage ```ruby require 'pandoc-ruby' @converter = PandocRuby.new('# Markdown Title', from: :markdown, to: :rst) puts @converter.convert ``` This takes the Markdown formatted string and converts it to reStructuredText. You can also use the `#convert` class method: ```ruby puts PandocRuby.convert('# Markdown Title', from: :markdown, to: :html) ``` Other arguments are simply converted into command line options, accepting symbols and strings for options and hashes for options with arguments. ```ruby PandocRuby.convert('# Markdown Title', :s, {f: :markdown, to: :rst}, '--wrap=none', :table_of_contents) ``` is equivalent to ```bash echo "# Markdown Title" | pandoc -s -f markdown --to=rst --wrap=none --table-of-contents ``` Also provided are `#to_[writer]` instance methods for each of the writers, and these can also accept options: ```ruby PandocRuby.new('# Example').to_html(:ascii) # => "
Line 1
\nLine 1 # Heading
\n ``` ### More Information For more information on Pandoc, see the [Pandoc documentation](http://pandoc.org) or run `man pandoc` ([also available here](https://pandoc.org/MANUAL.html)). If you'd prefer a pure-Ruby extended markdown interpreter that can output a few different formats, take a look at [kramdown](https://kramdown.gettalong.org/). If you want to use the full reStructuredText syntax from within Ruby, check out [RbST](https://github.com/xwmx/rbst), a docutils wrapper. This gem was inspired by [Albino](http://github.com/github/albino). For a slightly different approach to using Pandoc with Ruby, see [Pandoku](http://github.com/dahlia/pandoku). ## Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches.