How to generate PDF from markdown using pure ruby

不打扰是莪最后的温柔 提交于 2019-11-29 05:20:06

问题


I'm currently using Kramdown to generate HTML from Markdown in Ruby. I know that I can generate a latex file using kramdown and convert it to pdf usaing a command line utility. But I want a pure ruby solution.

Is there a way to convert markdown to pdf using only ruby without using command-line utilities?


回答1:


You can use https://github.com/walle/gimli

I made it just for this purpose. Though, I use textile. But gimli supports all formats supported by GitHub-Markup.




回答2:


Prawn: The Pure Ruby PDF Generation Library
http://www.rubyinside.com/prawn-ruby-pdf-library-987.html




回答3:


I haven't tried it myself, but there's md2pdf




回答4:


The wkhtmltopdf gem is also available: http://rubygems.org/gems/wkhtmltopdf




回答5:


Pandoc is a universal document converter which can convert documents in markdown, reStructuredText, textile, HTML, DocBook, or LaTeX to HTML, EPUB, Microsoft Word, TeX, PDF via LaTeX, Lightweight markup formats.

You can find it here. http://johnmacfarlane.net/pandoc/



来源:https://stackoverflow.com/questions/4377849/how-to-generate-pdf-from-markdown-using-pure-ruby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!