SelectFile -> 'Print / PDF'
andPDF -> 'Save as PDF'
in the print dialog (exact namingmight depend on your OS).
This will export exactly what’s shown in the preview, and not usepandoc at all.
You can change the styling of the preview and immediately see thechanges.
First, install thelatestpandoc version, then:
SelectFile -> Export
and choose a format.
If you have a YAML metadata block, like in the following example,PanWriter will look at the extension of the filename you chose in thedialog, and look up the corresponding key in theoutput
YAML metadata, for example when exporting the following markdown totest.html
:
---title: my documentfontsize: 18pxpdf-format: latex # optionaloutput: html: katex: true # for math output include-in-header: - foo.css - bar.js latex: pdf-engine: xelatex toc: true toc-depth: 3 template: letter.tex metadata: fontsize: 12pt epub: to: epub2 # default would be epub3---# my document
this command will be executed:
pandoc --toc --include-in-header foo.css --include-in-header bar.js --output test.html --to html --standalone
See thepandoc user’sguide for available options.
There are two exceptions to the rule that the key in theoutput
YAML is the file extension:
.tex
file, the key should be namedlatex
..pdf
file, the key for PanWriter tolook up in theoutput
YAML can be specified with thepdf-format
key (see example above). Default is alsolatex
, but you can also usecontext
,html
,ms
,beamer
, etc. See alsoCreating a PDFwith pandoc.Note how in the example above, we useto: epub2
, tooverwrite pandoc’s default format for the.epub
fileextensions. The same approach can be used for other ambiguous fileextensions like.html
(e.g. to: html4
,to: revealjs
, etc.).
You can place certain files in the PanWriter user directory, whichshouldbe:
/Users/your-user-name/Library/Application Support/PanWriterUserData
~/.config/PanWriterUserData
%APPDATA%
, which in Windows 10/11 isC:\Users\your-user-name\AppData\Roaming\PanWriterUserData
If the directory does not exist, you can create it.
If you put asettings.yaml
file in the data directory,PanWriter will read it on startup. Possible fields are currentlyonly:
autoUpdateApp: true
If you put adefault.yaml
file in the data directory,PanWriter will merge this with the YAML in your input file (to determinethe command-line arguments to call pandoc with) and add the--metadata-file
option. The YAML should be in the sameformat as above.
To include CSS in yourdefault.yaml
, you can also usethe same format as in-document metadata, for example:
header-includes: |- <style> blockquote { font-style: italic; } </style>
Note that when exporting via pandoc,pandoc’s templatewith its owndocument-cssis applied as well. You can turn it off by adding the following to yourYAML metadata:
document-css: false
You can e.g. puttype: letter
in the YAML of your inputdocument. In that case, PanWriter will look forletter.yaml
instead ofdefault.yaml
in the user data directory.
We usemarkdown-it
for the preview pane, which is fullyCommonMark-compliant. It supportsGFM tables (basicallypandocpipe_tables
) and GFM Strikethrough(strikeout
) out of the box. We also added abunch of plugins,to make the preview behave as much as pandoc as possible (includingattributes,fenced_divs
,definition_lists
,footnotes
,grid_tables
,implicit_figures
,subscript
,superscript
,yaml_metadata_block
andtex_math_dollars
). Weexplicitly don’t supportraw_html
orraw_tex
,since everything should be doable with thefenced_divs
,bracketed_spans
andraw_attribute
extensions.
However, there might still be minor differences between the previewandFile -> 'Print / PDF'
on one hand, andFile -> Export
on the other.
Things we should emulate in the preview, but for which there arenomarkdown-it plugins yet:
raw_attribute
:we should probably just strip them from preview \
Anugly workaround that already works is
Pandoc markdown supports a few more things which will not rendercorrectly in the preview, but which are not so commonly used. However,you can still use them in your markdown file, and export via pandoc willwork.
You can set up your system to launch PanWriter with:
panwriter myfile.md
On macOS, you should put the following in your~/.bash_profile
or similar:
function panwriter(){ open -a PanWriter "$@"; }
On Linux and Windows, you can make an alias to the correct locationof thepanwriter
executable.
Unfortunately, still no browser fully implements the CSS specs forpaged media (paged media are e.g. print or PDF). Therefore, PanWriter’spreview is powered bypagedjs – acollection of paged media polyfills bypagedmedia.org. Some background onusing CSS for print: