Custom 文档

概览

Custom Document 给予你 pandoc 的所有力量。
创建自定义文档,你需要在 markdown 文件中的 front-matter 里声明 custom_document 的输出类型,并且 path 项是必须被定义的:

下面的是一个展示了类似于 PDF 文档导出 的例子:

  1. ---
  2. title: "Habits"
  3. author: John Doe
  4. date: March 22, 2005
  5. output:
  6. custom_document:
  7. path: /Exports/test.pdf
  8. toc: true
  9. ---

下面的是一个展示了类似于 beamer presentation 的例子:

  1. ---
  2. title: "Habits"
  3. author: John Doe
  4. date: March 22, 2005
  5. output:
  6. custom_document:
  7. path: /Exports/test.pdf
  8. pandoc_args: ["-t", "beamer"]
  9. ---

Pandoc Arguments

If there are pandoc features you want to use that lack equivalents in the YAML options described above you can still use them by passing custom pandoc_args. For example:

  1. ---
  2. title: "Habits"
  3. output:
  4. custom_document:
  5. path: /Exports/test.pdf
  6. pandoc_args: [
  7. "--no-tex-ligatures"
  8. ]
  9. ---

Shared Options

If you want to specify a set of default options to be shared by multiple documents within a directory you can include a file named _output.yaml within the directory. Note that no YAML delimeters or enclosing output object are used in this file. For example:

_output.yaml

  1. custom_document:
  2. toc: true
  3. highlight: zenburn

All documents located in the same directory as _output.yaml will inherit it’s options. Options defined explicitly within documents will override those specified in the shared options file.