Weave.jl/v0.10.9/header/index.html

31 lines
9.9 KiB
HTML

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Header Configuration · Weave.jl</title><link rel="canonical" href="http://weavejl.mpastell.com/stable/header/"/><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit">Weave.jl</span></div><form class="docs-search" action="../search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../">Weave.jl - Scientific Reports Using Julia</a></li><li><a class="tocitem" href="../getting_started/">Getting started</a></li><li><a class="tocitem" href="../usage/">Using Weave</a></li><li><a class="tocitem" href="../publish/">Publishing to HTML and PDF</a></li><li><a class="tocitem" href="../chunk_options/">Chunk Options</a></li><li class="is-active"><a class="tocitem" href>Header Configuration</a><ul class="internal"><li><a class="tocitem" href="#Document-Metadata"><span>Document Metadata</span></a></li><li><a class="tocitem" href="#Configuration-Options"><span>Configuration Options</span></a></li><li><a class="tocitem" href="#Format-Specific-Options"><span>Format Specific Options</span></a></li></ul></li><li><a class="tocitem" href="../notebooks/">Working with Jupyter notebooks</a></li><li><a class="tocitem" href="../function_index/">Function index</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Header Configuration</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Header Configuration</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/JunoLab/Weave.jl/blob/master/doc/src/header.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Header-Configuration"><a class="docs-heading-anchor" href="#Header-Configuration">Header Configuration</a><a id="Header-Configuration-1"></a><a class="docs-heading-anchor-permalink" href="#Header-Configuration" title="Permalink"></a></h1><p>When <code>weave</code>ing 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 <code>---</code>.</p><div class="admonition is-warning"><header class="admonition-header">Warning</header><div class="admonition-body"><p>YAML header configuration is only supported when <code>weave</code>ing <a href="../usage/#document-syntax">markdown or Noweb syntax documents</a>.</p></div></div><h2 id="Document-Metadata"><a class="docs-heading-anchor" href="#Document-Metadata">Document Metadata</a><a id="Document-Metadata-1"></a><a class="docs-heading-anchor-permalink" href="#Document-Metadata" title="Permalink"></a></h2><p>You can set additional document metadata in YAML header. When <code>weave</code>ing to Julia markdown documents to HTML or PDF, Weave respects the following metadata specification:</p><ul><li><code>title</code></li><li><code>author</code></li><li><code>date</code></li></ul><p>An example:</p><pre><code class="language-yaml">---
title : Header Example
author : Shuhei Kadowaki
date: 16th May 2020
---</code></pre><div class="admonition is-info"><header class="admonition-header">Note</header><div class="admonition-body"><p>You can also have other metadata, but they won&#39;t appear in the resulting HTML and PDF. If you weave to Julia markdown to GitHub/Hugo markdown, all the metadata will be preserved.</p></div></div><h3 id="Dynamic-Metadata"><a class="docs-heading-anchor" href="#Dynamic-Metadata">Dynamic Metadata</a><a id="Dynamic-Metadata-1"></a><a class="docs-heading-anchor-permalink" href="#Dynamic-Metadata" title="Permalink"></a></h3><p>The metadata can be given &quot;dynamically&quot;; if you have <a href="../usage/#inline-code">inline code</a> within YAML header, they will be evaluated <em>after</em> evaluating all the chunks and replaced with the results.</p><p>The example document below will set <code>date</code> metadata dynamically. Note that <code>Date</code> is available since the chunk is evaluated first.</p><pre><code class="language-md"> ---
title : Header Example
author : Shuhei Kadowaki
date: `j import Dates; Dates.Date(Dates.now())`
---
```julia; echo = false
using Dates
```</code></pre><h2 id="Configuration-Options"><a class="docs-heading-anchor" href="#Configuration-Options">Configuration Options</a><a id="Configuration-Options-1"></a><a class="docs-heading-anchor-permalink" href="#Configuration-Options" title="Permalink"></a></h2><p>Each of keyword arguments of <a href="../usage/#Weave.weave"><code>weave</code></a> can be set in the YAML header under <code>options</code> field. You can also set <a href="@ref">Chunks Options</a> there that will be applied globally.</p><p>The example below sets <code>out_path</code> and <code>doctype</code> options and overwrites <code>term</code> and <code>wrap</code> chunk options:</p><pre><code class="language-yaml">---
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
---</code></pre><div class="admonition is-info"><header class="admonition-header">Note</header><div class="admonition-body"><ul><li>configurations specified within the YAML header have higher precedence than those specified via <code>weave</code> keyword arguments</li><li>chunk options specified within each chunk have higher precedence than the global global chunk options specified within the YAML header</li></ul></div></div><div class="admonition is-warning"><header class="admonition-header">Warning</header><div class="admonition-body"><p>As opposed to metadata, <em>most</em> of those configuration options can&#39;t be given dynamically (i.e. can&#39;t be via inline code), since they are needed for evaluation of chunks themselves. But some configuration options that are needed &quot;formatting&quot; document can still be given dynamically:</p><ul><li><code>template</code></li><li><code>css</code></li><li><code>highlight_theme</code></li><li><code>pandoc_options</code></li><li><code>latex_cmd</code></li><li><code>keep_unicode</code></li></ul><p>See also: <a href="../usage/#Weave.weave"><code>weave</code></a></p></div></div><h2 id="Format-Specific-Options"><a class="docs-heading-anchor" href="#Format-Specific-Options">Format Specific Options</a><a id="Format-Specific-Options-1"></a><a class="docs-heading-anchor-permalink" href="#Format-Specific-Options" title="Permalink"></a></h2><p>The header configurations can be format specific. Here is how to set different <code>out_path</code> for <code>md2html</code> and <code>md2pdf</code> and set <code>fig_ext</code> globally:</p><pre><code class="language-yaml">---
weave_options:
md2html:
out_path : html
md2pdf:
out_path : pdf
fig_ext : .png
---</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../chunk_options/">« Chunk Options</a><a class="docs-footer-nextpage" href="../notebooks/">Working with Jupyter notebooks »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Tuesday 1 June 2021 08:37">Tuesday 1 June 2021</span>. Using Julia version 1.5.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>