如何使用纯ruby从mar​​kdown生成PDF

时间:2022-05-24 00:29:28

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.

我目前正在使用Kramdown从Ruby中的Markdown生成HTML。我知道我可以使用kramdown生成一个latex文件,并将其转换为pdf美国命令行实用程序。但我想要一个纯粹的红宝石解决方案。

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

有没有办法在不使用命令行实用程序的情况下仅使用ruby将markdown转换为pdf?

5 个解决方案

#1


21  

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

您可以使用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.

我是为了这个目的而做的。虽然,我使用纺织品。但gimli支持GitHub-Markup支持的所有格式。

#2


5  

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

虾:纯Ruby PDF生成库http://www.rubyinside.com/prawn-ruby-pdf-library-987.html

#3


3  

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

我自己没试过,但是有md2pdf

#4


2  

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

wkhtmltopdf gem也可用:http://rubygems.org/gems/wkhtmltopdf

#5


-1  

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.

Pandoc是一个通用文档转换器,可以通过LaTeX,轻量级标记格式将markdown,reStructuredText,textile,HTML,DocBook或LaTeX中的文档转换为HTML,EPUB,Microsoft Word,TeX,PDF。

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

你可以在这里找到它。 http://johnmacfarlane.net/pandoc/

#1


21  

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

您可以使用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.

我是为了这个目的而做的。虽然,我使用纺织品。但gimli支持GitHub-Markup支持的所有格式。

#2


5  

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

虾:纯Ruby PDF生成库http://www.rubyinside.com/prawn-ruby-pdf-library-987.html

#3


3  

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

我自己没试过,但是有md2pdf

#4


2  

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

wkhtmltopdf gem也可用:http://rubygems.org/gems/wkhtmltopdf

#5


-1  

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.

Pandoc是一个通用文档转换器,可以通过LaTeX,轻量级标记格式将markdown,reStructuredText,textile,HTML,DocBook或LaTeX中的文档转换为HTML,EPUB,Microsoft Word,TeX,PDF。

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

你可以在这里找到它。 http://johnmacfarlane.net/pandoc/