pandoc README

The project's README from github.com/jgm/pandoc. As one markdown file: README.md.

Pandoc

github
release hackage
release homebrew stackage LTS
package CI
tests license pandoc-discuss on google
groups

The universal markup converter

Pandoc is a Haskell library for converting from one markup format to another, and a command-line tool that uses this library.

It can convert from

It can convert to

Pandoc can also produce PDF output via LaTeX, Groff ms, or HTML.

Pandoc’s enhanced version of Markdown includes syntax for tables, definition lists, metadata blocks, footnotes, citations, math, and much more. See the User’s Manual below under Pandoc’s Markdown.

Pandoc has a modular design: it consists of a set of readers, which parse text in a given format and produce a native representation of the document (an abstract syntax tree or AST), and a set of writers, which convert this native representation into a target format. Thus, adding an input or output format requires only adding a reader or writer. Users can also run custom pandoc filters to modify the intermediate AST (see the documentation for filters and Lua filters).

Because pandoc’s intermediate representation of a document is less expressive than many of the formats it converts between, one should not expect perfect conversions between every format and every other. Pandoc attempts to preserve the structural elements of a document, but not formatting details such as margin size. And some document elements, such as complex tables, may not fit into pandoc’s simple document model. While conversions from pandoc’s Markdown to all formats aspire to be perfect, conversions from formats more expressive than pandoc’s Markdown can be expected to be lossy.

Installing

Here’s how to install pandoc.

Documentation

Pandoc’s website contains a full User’s Guide. It is also available here as pandoc-flavored Markdown. The website also contains some examples of the use of pandoc, a limited online demo, and a WebAssembly-based online demo.

Contributing

Pull requests, bug reports, and feature requests are welcome. Please make sure to read the contributor guidelines before opening a new issue.

License

© 2006-2024 John MacFarlane ([email protected]). Released under the GPL, version 2 or greater. This software carries no warranty of any kind. (See COPYRIGHT for full copyright and warranty notices.)

pandoc (jgm/pandoc)

Searching Database…

46.6K ·GitHub
这是干什么的?Pandoc 是一个用 Haskell 编写的文档转换库,可以把文档从一种标记格式转换成另一种,附带的命令行工具就是基于它构建的——堪称万能的标记格式转换器。
它是命令行工具,还是写代码时调用的库?两者都是。它既提供命令行工具,可以直接做格式转换,也提供 Haskell 库,可以集成到你自己的程序里。
安装起来麻烦吗?不麻烦——README 只是指向 pandoc 官网的安装页面,你在那里选择适合自己操作系统的安装包;装好之后在终端里运行 pandoc 就行。
每次转换都能做到完美无缺吗?不能。Pandoc 能保留文档的结构,但像页边距大小这类排版细节会丢失;而且如果源格式比它的 Markdown 表现力更强,转换就可能损失内容。
不安装任何东西,能在浏览器里试用吗?可以——pandoc 官网上有一个基于 WebAssembly 的在线演示(旁边还有一个功能有限的经典版),直接在浏览器里就能做转换。
到底支持多少种格式?输入格式大约有 50 种——包括 Word docx、LaTeX、EPUB、Jupyter notebook、MediaWiki,甚至还有 Excel 表格——输出格式的清单更长,PDF 则可以通过 LaTeX、Groff ms 或 HTML 生成。
和普通 Markdown 相比,Pandoc Markdown 多了什么?它增强的 Markdown 增加了不少语法:表格、定义列表、元数据块、脚注、引用文献、数学公式等等。
一个工具怎么能支持这么多格式?靠模块化设计:读取器把每种输入解析成一棵内部抽象语法树,写出器再把这棵树渲染成目标格式,所以支持一种新格式只需写一个读取器或写出器。
我能自定义读取和写出之间的处理过程吗?可以——你可以使用自定义的 pandoc 过滤器,包括 Lua 过滤器,在生成最终输出格式之前修改中间的 AST。
Creator
jgm
Size
71.9 MB
Stars
46.6K
Age
16y
Commits · 90 Days