作者:Yihui Xie
译者:郑宝童
日期:2021.05.14


1.1 Motivation

Markdown is a wonderful language to write relatively simple documents that contain elements like sections, paragraphs, lists, links, and images, etc. Pandoc (http://pandoc.org) has greatly extended the original Markdown syntax, and added quite a few useful new features, such as footnotes, citations, and tables. More importantly, Pandoc makes it possible to generate output documents of a large variety of formats from Markdown, including HTML, LaTeX/PDF, Word, and slides.

Markdown是一种非常棒的语言,可以用来编写包含段落、段落、列表、链接和图像等元素的相对简单的文档。Pandoc (http://pandoc.org)极大地扩展了原来的Markdown语法,并添加了一些有用的新特性,如脚注、引用和表格。更重要的是,Pandoc可以从Markdown生成多种格式的输出文档,包括HTML、LaTeX/PDF、Word和幻灯片。

There are still a few useful features missing in Pandoc’s Markdown at the moment that are necessary to write a relatively complicated document like a book, such as automatic numbering of figures and tables in the HTML output, cross-references of figures and tables, and fine control of the appearance of figures (e.g., currently it is impossible to specify the alignment of images using the Markdown syntax). These are some of the problems that we have addressed in the bookdown package.

当前Pandoc的markdown在写相对复杂的文档(比如一本书)时,仍然缺少一些有用的特性,例如HTML输出中图形和表格的自动编号,图形和表格的交叉引用,以及对图形外观的精细控制(例如,目前不可能使用Markdown语法指定图像的对齐方式)。这些问题我们在bookdown中已经解决。

Under the constraint that we want to produce the book in multiple output formats, it is nearly impossible to cover all possible features specific to these diverse output formats. For example, it may be difficult to reinvent a certain complicated LaTeX environment in the HTML output using the (R) Markdown syntax. Our main goal is not to replace everything with Markdown, but to cover most common functionalities required to write a relatively complicated document, and make the syntax of such functionalities consistent across all output formats, so that you only need to learn one thing and it works for all output formats.

由于我们希望以多种输出格式生成图书,因此几乎不可能涵盖针对这些不同输出格式的所有可能特性。例如,可能很难在HTML输出中使用(R) Markdown语法重新创建某个复杂的LaTeX环境。我们的主要目的不是为了让markdown取代一切,而是让markdown在写一本相对复杂文档时涵盖最常见的功能,并使这些功能的语法在所有输出格式之间保持一致,这样您只需要学习一件事,它适用于所有输出格式。

Another goal of this project is to make it easy to produce books that look visually pleasant. Some nice existing examples include GitBook (https://www.gitbook.com), Tufte CSS (http://edwardtufte.github.io/tufte-css/), and Tufte-LaTeX (https://tufte-latex.github.io/tufte-latex/). We hope to integrate these themes and styles into bookdown, so authors do not have to dive into the details of how to use a certain LaTeX class or how to configure CSS for HTML output.

这个项目的另一个目标是使得制作令人赏心悦目的书籍变得容易。已经有一些很好的示例:包括GitBook (https://www.gitbook.com)、Tufte CSS (http://edwardtufte.github.io/tufte-css/)和Tufte- latex (https://tufte-latex.github.io/tufte-latex/)。我们希望将这些主题和样式集成到**bookdown**,这样作者就不必深入研究如何使用某个LaTeX类或如何为HTML输出配置CSS的细节。