--- title: Pandoc subtitle: A universal document converter and its ecosystem author: Yasin Raies theme: white center: true width: 1024 height: 960 transition: fade date: 09.01.1984 --- ::: {style="text-align:center"}  ::: # What is Pandoc ---------------------- Pandoc is a free and open-source software document converter created by John MacFarlane. Supported Formats:\ :::::::::::::: {.columns style="font-size:0.7em"} ::: {.column width="50%"} **In** commonmark, creole, docbook, docx, epub, fb2, gfm (GitHub-Flavored Markdown), haddock, html, jats, json, latex, markdown (Pandoc’s Markdown), markdown\_mmd, markdown\_phpextra, markdown\_strict, mediawiki, man, muse, native, odt, opml, org, rst, t2t, textile, tikiwiki, twiki, vimwiki ::: ::: {.column width="50%"} **Out** asciidoc, beamer, commonmark, context, docbook or docbook4, docbook5, docx, dokuwiki, epub or epub3, epub2, fb2, gfm (GitHub-Flavored Markdown), haddock, html or html5 (HTML, i.e. HTML5/XHTML polyglot markup), html4, icml, jats, json, latex, man, markdown (Pandoc’s Markdown), markdown\_mmd, markdown\_phpextra, markdown\_strict, mediawiki, ms, muse, native, odt, opml, opendocument, org, plain, pptx, rst, rtf, texinfo, textile, slideous, slidy, dzslides, revealjs, s5, tei, zimwiki ::: :::::::::::::: # Pandoc-flavoured Markdown > A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. > - [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy) PFM (pandoc favoured Markdown) expands on this by having multiple outputformats in mind. ----------------------------- ## Metadata ``` --- title: Pandoc subtitle: A universal document converter and its ecosystem author: Yasin Raies theme: white center: true width: 1280 height: 720 date: 09.01.2019 --- ``` ----------------------------- ## Inline ::: {} |In | Out | |--------------------------------------|------------------------------------| | `text` | text | | `*emphasis*` | *emphasis* | | `**strong**` | **strong** | | `~~strike~~` | ~~strike~~ | | `S~ub~ S^uper^` | S~ub~ S^uper^ | | `$$e^{\pi i} + 1 = 0$$` | $e^{\pi i} + 1 = 0$ | ::: ----------------------------- ::: {} |In | Out | |--------------------------------------|------------------------------------| | `"Quote"` | "Quote" | | `` `*verb/code*` `` | `*verb/code*` | | `[FMI](fmi-wuerzburg.de)` | [FMI](http://www.fmi-wuerzburg.de) | | `` | { width=0.5cm }| | `word^[Some Note]` | word^[Some Note] | | `[This is a *span*]{.smallcaps}` | [This is a *span*]{.smallcaps} | ::: ----------------------------- ## Blocks ----------------------------- ### LineBlock :::::::::::::: {.columns} ::: {.column width="50%"} | **Ingredients**: | 0.5 Lime | 5 *tbsp* Sugar | 350 *ml* Ginger Ale | Crusehd Ice ::: ::: {.column width="50%"} ``` | **Ingredients**: | 0.5 Lime | 5 *tbsp* Sugar | 350 *ml* Ginger Ale | Crusehd Ice ``` ::: :::::::::::::: ----------------------------- ### Verbatim/Code :::::::::::::: {.columns} ::: {.column width="50%"} ```java while(true){ doTalk(); } ``` ::: ::: {.column width="50%"} ~~~ ```java while(true){ doTalk(); } ``` ~~~ ::: :::::::::::::: ----------------------------- ### Quotes :::::::::::::: {.columns} ::: {.column width="50%"} > This is a blockquote ::: ::: {.column width="50%"} `> This is a blockquote` ::: :::::::::::::: ----------------------------- ### Ordered/Bullet List :::::::::::::: {.columns} ::: {.column width="50%"} I) one 3. two 7. three I) five - some + things + are - weird ::: ::: {.column width="50%"} ~~~ I) one 3. two 7. three I) five - some + things + are - weird ~~~ ::: :::::::::::::: ----------------------------- ### Definition List :::: {.columns} ::: {.column width="50%"} Term 1 ~ Definition 1 Term 2 ~ Definition 2a ~ Definition 2b ::: ::: {.column width="50%"} ~~~ Term 1 ~ Definition 1 Term 2 ~ Definition 2a ~ Definition 2b ~~~ ::: :::: ----------------------------- ### Example List (@) This is a numbered example. (@ex) This example can be referenced. See (@ex). ~~~ (@) This is a numbered example. (@ex) This example can be referenced. See (@ex). ~~~ ----------------------------- ### Tables Right Left Center Default ------- ------ ---------- ------- 12 12 12 12 +---------------+---------------+--------------------+ | Fruit | Price | Advantages | +===============+===============+====================+ | Bananas | $1.34 | - built-in wrapper | | | | - bright color | +---------------+---------------+--------------------+ | Right | Left | Default | Center | |------:|:-----|---------|:------:| | 12 | 12 | 12 | 12 | ----------------------------- ~~~ Right Left Center Default ------- ------ ---------- ------- 12 12 12 12 +---------------+---------------+--------------------+ | Fruit | Price | Advantages | +===============+===============+====================+ | Bananas | $1.34 | - built-in wrapper | | | | - bright color | +---------------+---------------+--------------------+ | Right | Left | Default | Center | |------:|:-----|---------|:------:| | 12 | 12 | 12 | 12 | ~~~ ----------------------------- ### Headers, Rules and Divs {#headers-and-stuff} ::::: {.columns} :::: {.column width="30%"} ::: {style="color:red"} This is a div. ::: :::: :::: {.column width="70%"} ~~~ ### Headers, Rules and Divs {#headers-and-stuff} ::: {style="color:red"} This is a div. ::: ~~~ :::: ::::: # Working with Pandoc ----------------------- ## The Pipeline ::: {style="text-align: center"} __Reader $\Rightarrow$ Filters $\Rightarrow$ Writer $\Rightarrow$ Template__ ::: Reader/Writer ~ Convert between a given format and an AST ^[also known as the "native format"] Filter ~ Performs operations on and modifies the AST Template ~ Supplys a surrounding in which the converted AST is embedded ----------------------- ## The CLI Pandoc has *some* parameters: ``` pandoc [OPTIONS] [FILES] -f FORMAT, -r FORMAT --from=FORMAT, --read=FORMAT -t FORMAT, -w FORMAT --to=FORMAT, --write=FORMAT -o FILE --output=FILE --data-dir=DIRECTORY --base-header-level=NUMBER --strip-empty-paragraphs --indented-code-classes=STRING -F PROGRAM --filter=PROGRAM --lua-filter=SCRIPTPATH -Pandoc is a free and open-source software document converterp --preserve-tabs --tab-stop=NUMBER --track-changes=accept|reject|all --file-scope --extract-media=PATH -s --standalone --template=FILE -M KEY[:VALUE] --metadata=KEY[:VALUE] -V KEY[:VALUE] --variable=KEY[:VALUE] -D FORMAT --print-default-template=FORMAT --print-default-data-file=FILE --print-highlight-style=STYLE|FILE --dpi=NUMBER --eol=crlf|lf|native --wrap=auto|none|preserve --columns=NUMBER --strip-comments --toc, --table-of-contents --toc-depth=NUMBER --no-highlight --highlight-style=STYLE|FILE --syntax-definition=FILE -H FILE --include-in-header=FILE -B FILE --include-before-body=FILE -A FILE --include-after-body=FILE --resource-path=SEARCHPATH --request-header=NAME:VALUE --self-contained --html-q-tags --ascii --reference-links --reference-location=block|section|document --atx-headers --top-level-division=section|chapter|part -N --number-sections --number-offset=NUMBERS --listings -i --incremental --slide-level=NUMBER --section-divs --default-image-extension=extension --email-obfuscation=none|javascript|references --id-prefix=STRING -T STRING --title-prefix=STRING -c URL --css=URL --reference-doc=FILE --epub-subdirectory=DIRNAME --epub-cover-image=FILE --epub-metadata=FILE --epub-embed-font=FILE --epub-chapter-level=NUMBER --pdf-engine=PROGRAM --pdf-engine-opt=STRING --bibliography=FILE --csl=FILE --citation-abbreviations=FILE --natbib --biblatex --mathml --webtex[=URL] --mathjax[=URL] --katex[=URL] --gladtex --abbreviations=FILE --trace --dump-args --ignore-args --verbose --quiet --fail-if-warnings --log=FILE --bash-completion --list-input-formats --list-output-formats --list-extensions[=FORMAT] --list-highlight-languages --list-highlight-styles -v --version -h --help ``` ----------------------- Compiling Markdown to HTML:\ ``` pandoc --standalone --from markdown --to html -o Out.html In.txt ``` Compiling this talk:\ ``` echo recompiling HTML pandoc -f markdown+emoji -s --toc --toc-depth=2 --css gitlab.css -o Vortrag.html Vortrag.md echo recompiling Reveal pandoc -f markdown+emoji -s -t revealjs -o Vortrag_reveal.html -V revealjs-url=reveal.js-3.7.0 --slide-level 2 Vortrag.md ``` ----------------------- ## Templates Variables filled into templates are taken from metadata or commandline-arguments.\ They are referenced by `$varname$`.\ To check if a variable is set use `$if(var)$` with `$endif$`.\ Iteration is also possible: ``` $for(var)$$var$$sep$, $endfor$ ``` ----- HTML Template: ::: {style="font-size: 0.8em"} ```html
$for(author-meta)$ $endfor$ $if(date-meta)$ $endif$ $if(keywords)$ $endif$$subtitle$
$endif$ $for(author)$ $endfor$ $if(date)$$date$
$endif$