I have a Markdown file with mixed Markdown and TeX content which is meant for being converted to PDF in the end.
I have a YAML header with something like this:
---
title: "mytitle"
#author: [someone]
lang: "de"
date: \today
toc: false
toc-own-page: false
numbersections: false
listings: true
header-includes: |
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{wasysym}
\usepackage{extarrows}
\usepackage[iso,german]{isodate}
\setcounter{page}{1}
---
Now I'm using pandoc to 'prettify' / format my document on every save:
pandoc -f markdown -t markdown --standalone -Vheader-includes='' --reference-links
This produces this output:
---
date: "`\\today`{=tex}"
header-includes: |
```{=tex}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{wasysym}
\usepackage{extarrows}
\usepackage[iso,german]{isodate}
\setcounter{page}{1}
```
lang: de
listings: true
numbersections: false
title: mytitle
toc: false
toc-own-page: false
---
Although I'm not happy with the {=tex}
-blocks, I see why they might make sense and know that I could disable them with -t markdown-raw_attribute
But is there a way to keep the commented-out author in the YAML header block?
Pandoc does not preserve the textual representation in the YAML block, keeping comments is not possible. You could prefix the unused YAML key with _
to avoid having it influence other output.
It would be possible to keep the YAML in a separate file and to include it with --metadata-file=...
, that would make it easy to ensure that only the text is processed.