Pandoc: Difference between revisions
From wikinotes
(2 intermediate revisions by the same user not shown) | |||
Line 42: | Line 42: | ||
= Syntax Highlighting = | = Syntax Highlighting = | ||
<blockquote> | |||
== Standalone Renders == | |||
<blockquote> | <blockquote> | ||
pandoc uses [[haskell skylighting]] to render syntaxhighlighting for various output formats.<br> | pandoc uses [[haskell skylighting]] to render syntaxhighlighting for various output formats.<br> | ||
You can enable this using the <code>pandoc ... --standalone</code> param. | You can enable this using the <code>pandoc ... --standalone</code> param. | ||
</blockquote><!-- Standalone Renders --> | |||
== Generate Style == | |||
<blockquote> | |||
{{ expand | |||
| Dump base style.css | |||
| | |||
You can dump the raw CSS template (which is rendered using [[haskell doctemplates]]) with | |||
<syntaxhighlight lang="bash"> | |||
pandoc --print-default-data-file=templates/styles.html | |||
</syntaxhighlight> | |||
}} | |||
{{ expand | |||
| Dump base highlighting.css | |||
| | |||
Copied from: https://stackoverflow.com/questions/62774695/pandoc-where-are-css-files-for-syntax-highlighting-code | |||
highlighting-css.template | |||
<syntaxhighlight lang="bash"> | |||
$highlighting-css$ | |||
</syntaxhighlight> | |||
sample.md | |||
<syntaxhighlight lang="markdown"> | |||
~~~html | |||
<p>placeholder</p> | |||
~~~ | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
pandoc | pandoc --template=highlighting-css.template sample.md -o highlighting.css | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Now <code>highlighting.css</code> will contain the syntaxhighlighting css. | |||
}} | |||
</blockquote><!-- Generate Style --> | |||
</blockquote><!-- Syntax Highlighting --> | </blockquote><!-- Syntax Highlighting --> |
Latest revision as of 02:02, 30 July 2022
Text format converter.
Documentation
man pandoc
https://man.archlinux.org/man/community/pandoc/pandoc.1.en github https://github.com/jgm/pandoc
Locations
/usr/share/pandoc/data/templates/styles.html
css partial/template
Usage
pandoc --list-input-formats pandoc --list-extensions pandoc \ -f ${IN_FORMAT} \ -t ${TO_FORMAT} \ -o ${OUTFILE}Examples
cat file.rst | pandoc -f rst -t html # read stdin, render to stdout pandoc -f docx input.docx # pandoc -o output.pdf -f docx input.docx #
Syntax Highlighting
Standalone Renders
pandoc uses haskell skylighting to render syntaxhighlighting for various output formats.
You can enable this using thepandoc ... --standalone
param.Generate Style
Dump base style.css
You can dump the raw CSS template (which is rendered using haskell doctemplates) withpandoc --print-default-data-file=templates/styles.html
Dump base highlighting.css
Copied from: https://stackoverflow.com/questions/62774695/pandoc-where-are-css-files-for-syntax-highlighting-codehighlighting-css.template
$highlighting-css$
sample.md
~~~html <p>placeholder</p> ~~~
pandoc --template=highlighting-css.template sample.md -o highlighting.cssNow
highlighting.css
will contain the syntaxhighlighting css.