weaveing a markdown document, you use YAML header to provide additional metadata and configuration options. A YAML header should be in the beginning of the input document delimited with
YAML header configuration is only supported when
weaveing markdown or Noweb syntax documents.
You can set additional document metadata in YAML header. When
weaveing to Julia markdown documents to HTML or PDF, Weave respects the following metadata specification:
--- title : Header Example author : Shuhei Kadowaki date: 16th May 2020 ---
You can also have other metadata, but they won't appear in the resulting HTML and PDF. If you weave to Julia markdown to GitHub/Hugo markdown, all the metadata will be preserved.
The metadata can be given "dynamically"; if you have inline code within YAML header, they will be evaluated after evaluating all the chunks and replaced with the results.
The example document below will set
date metadata dynamically. Note that
Date is available since the chunk is evaluated first.
--- title : Header Example author : Shuhei Kadowaki date: `j import Dates; Dates.Date(Dates.now())` --- ```julia; echo = false using Dates ```
The example below sets
doctype options and overwrites
wrap chunk options:
--- title : Header Example author : Shuhei Kadowaki date: 16th May 2020 weave_options: out_path: relative/path/to/this/document doctype: github term: true wrap: false ---
- configurations specified within the YAML header have higher precedence than those specified via
- chunk options specified within each chunk have higher precedence than the global global chunk options specified within the YAML header
As opposed to metadata, most of those configuration options can't be given dynamically (i.e. can't be via inline code), since they are needed for evaluation of chunks themselves. But some configuration options that are needed "formatting" document can still be given dynamically:
The header configurations can be format specific. Here is how to set different
md2pdf and set
--- weave_options: md2html: out_path : html md2pdf: out_path : pdf fig_ext : .png ---