Daily Tech Briefing
AI 科技速览

每天 5 分钟内学习 AI。获取最新的人工智能新闻,理解其重要性,并学习如何将其应用于您的工作。

AI 快讯
Hacker News · 2026/8/3 15:04:53
Twenty Years of Pandoc

Twenty Years of Pandoc

AI 中文解读
Pandoc迎来二十岁生日!这个在程序员圈子里被奉为神器的文档转换工具,最初只是作者John MacFarlane用3000行代码写的小项目,如今却成长为支持超过五十种文档格式的“格式翻译官”。打个比方,你手上有一个Word文档,想转成网页、PDF甚至是电子书格式,Pandoc就像一位通晓各国语言的翻译,能帮你把内容无损地“翻译”成任何你需要的格式。这位哲学教授当年出于对编程语言的兴趣写了这个工具,完全没料到它会在学术界引发一场效率革命。现在,科研人员写作论文时用到的Quarto、数据分析师使用的Jupyter Notebook,背后都有它的身影。对于普通人来说,你无需了解它的技术细节,但当你用在线工具把文档转成PDF、或者一键导出电子书时,背后可能就是Pandoc在默默工作。这个开源项目二十年如一日的更新,也让我们看到:一个看似简单的工具,只要坚持打磨,也能改变全球数以百万计用户的工作方式。
Please help Ukraine! Sponsor Pandoc   a universal document converter About Installing Demos Documentation Getting started User's Guide User's Guide (PDF) Contributing FAQ Filters Lua filters Custom readers Custom writers pandoc-server Making an ebook Emacs Org mode support JATS support Typst property attributes Using the Pandoc API API documentation Twenty Years of Pandoc Press Help Extras Releases Search Twenty Years of Pandoc On August 3, 2006, I uploaded the first version of pandoc to my website, releasing it under the free GPL license. Pandoc 0.1 consisted of about 3000 lines of Haskell code, with no dependencies aside from GHC’s standard library. It could convert Markdown, reStructuredText, HTML, and LaTeX documents into any of these formats, plus RTF or S5. I had no idea at the time that this would just be the first of over two hundred releases over the next twenty years; that the project would become the most popular program written in Haskell; that I would spend countless hours on bug-fixes, improvement, and project management; that I would collaborate with programmers in many other countries; that pandoc would come to support over fifty document formats; that it would allow automatic generation of citations and bibliographies; that it would become integrated into academic writing tools like Quarto and Jupyter Notebook; that it would be installed on millions of computers around the world. How did this happen? I want to take advantage of pandoc’s birthday to tell the story of the project, as best I can remember it. John MacFarlane August 2, 2026 Prehistory People often ask: Why is pandoc written in Haskell? There could have been good answers to this question: Haskell is a very good language for writing this kind of application. But in fact, I didn’t decide to write a document converter, then decide to use Haskell for it. I decided to use Haskell, and then decided to write a document converter in it. I had heard about Haskell from the blog of a philosophical logician friend, Greg Restall. Of an introductory book on Haskell, he said: “I’m glad that this wasn’t the textbook in my introductory computer science course, long ago in 1986. If it were, I may have fallen in love with computing and never become a philosopher” (consequently.org). Intrigued by this (and not heeding Restall’s warning about the potential effects on my future philosophical productivity), I read A Gentle Introduction to Haskell to get a basic understanding of the language. But the only way to really learn a programming language is to write something in it. I saw that Haskell was good for writing parsers and compilers, and it came with a really nice parser combinator library (parsec), so I decided to write a Markdown parser. At that time, there were implementations of Markdown in Perl, Python, Ruby, and PHP; they all transformed Markdown directly to HTML through a sequence of regex transformations. Pandoc took a different approach. It parsed the Markdown using parser combinators and produced a real abstract syntax tree (AST), which it could then render to HTML or another format. This was a more reliable architec
分享
阅读原文