pdfmd-cli 3.25.20__tar.gz → 3.26.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pdfmd_cli-3.25.20/pdfmd_cli.egg-info → pdfmd_cli-3.26.20}/PKG-INFO +289 -8
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/README.md +288 -7
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd.py +1681 -146
- pdfmd_cli-3.26.20/pdfmd_check/__init__.py +15 -0
- pdfmd_cli-3.26.20/pdfmd_check/lint.py +581 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20/pdfmd_cli.egg-info}/PKG-INFO +289 -8
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_cli.egg-info/SOURCES.txt +45 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_cli.egg-info/top_level.txt +4 -0
- pdfmd_cli-3.26.20/pdfmd_flat/__init__.py +81 -0
- pdfmd_cli-3.26.20/pdfmd_flat/asciify.py +315 -0
- pdfmd_cli-3.26.20/pdfmd_flat/keep.py +176 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_help/__init__.py +8 -4
- pdfmd_cli-3.26.20/pdfmd_labels/__init__.py +24 -0
- pdfmd_cli-3.26.20/pdfmd_labels/replay.py +73 -0
- pdfmd_cli-3.26.20/pdfmd_labels/scan.py +228 -0
- pdfmd_cli-3.26.20/pdfmd_lua/ascii.lua +135 -0
- pdfmd_cli-3.26.20/pdfmd_lua/diagram.lua +219 -0
- pdfmd_cli-3.26.20/pdfmd_lua/flat.lua +510 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_lua/pdf_images.lua +10 -4
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_lua/raw.lua +148 -16
- pdfmd_cli-3.26.20/pdfmd_lua/select.lua +92 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_raw/__init__.py +6 -4
- pdfmd_cli-3.26.20/pdfmd_templates/__init__.py +119 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/article/__name__.md +40 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/article/description.txt +1 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/article/next.txt +1 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/article/refs.bib +6 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/book/__name__.md +8 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/book/description.txt +1 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/book/next.txt +1 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/book/parts/10-introduction.md +4 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/book/parts/20-methods.md +7 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/book/parts/30-results.md +3 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/notes/__name__.md +25 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/notes/description.txt +1 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/notes/next.txt +1 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/report/__name__.md +32 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/report/data.csv +4 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/report/description.txt +1 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/report/next.txt +1 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/slides/__name__.md +20 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/slides/description.txt +1 -0
- pdfmd_cli-3.26.20/pdfmd_templates/data/slides/next.txt +1 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pyproject.toml +2 -1
- pdfmd_cli-3.26.20/tests/test_ascii.py +266 -0
- pdfmd_cli-3.26.20/tests/test_budget.py +157 -0
- pdfmd_cli-3.26.20/tests/test_build_record.py +133 -0
- pdfmd_cli-3.26.20/tests/test_check.py +247 -0
- pdfmd_cli-3.26.20/tests/test_diagrams.py +303 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_display_path.py +16 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_doctor.py +26 -2
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_edit.py +5 -1
- pdfmd_cli-3.26.20/tests/test_flat.py +440 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_help.py +3 -0
- pdfmd_cli-3.26.20/tests/test_keep_source.py +212 -0
- pdfmd_cli-3.26.20/tests/test_labels.py +343 -0
- pdfmd_cli-3.26.20/tests/test_latex_errors.py +79 -0
- pdfmd_cli-3.26.20/tests/test_lua_trust.py +129 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_raw.py +1 -1
- pdfmd_cli-3.26.20/tests/test_reader.py +73 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_sections.py +3 -3
- pdfmd_cli-3.26.20/tests/test_templates.py +159 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/LICENSE +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_cli.egg-info/dependency_links.txt +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_cli.egg-info/entry_points.txt +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_cli.egg-info/requires.txt +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_direct/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_direct/defaults.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_direct/html.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_direct/typst.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_edit/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_history/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_history/git.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_history/hst.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_history/versions.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_images/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_images/remote.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_images/scan.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_images/svg.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/LICENSE +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/VENDORED.md +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/_kerning_data.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/assets/fonts/DejaVuSans-LICENSE.txt +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/assets/fonts/DejaVuSans.ttf +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/ast.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/cidfont.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/embedded.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/embedded_metrics.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/emoji.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/emoji_font.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/fonts.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/html_filter.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/image_loader.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/layout.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/parser.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/pdf.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/py.typed +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/render.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/truetype.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_inkmd/url_filter.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_lua/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_lua/code.lua +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_lua/code_wrap.tex +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_lua/csv_table.lua +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_lua/graphicx.tex +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_lua/images.lua +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_lua/table_width.lua +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/docx.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/docx_post.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/fonts.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/fragments.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/labels.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/odt.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/office.lua +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/spec.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_office/units.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_setup/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_setup/fancy.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_setup/plain.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_setup/registry.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_tables/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_tables/convert.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_tables/scan.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_tables/verify.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/__init__.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/_catalog.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/_scripts.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/_tessdata_catalog.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/colorfont.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/emoji.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/fonts.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/install.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/plan.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/scripts.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/tessdata.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/pdfmd_unicode/translit.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/setup.cfg +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_api.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_apple_emoji.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_attach.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_cache_location.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_code_blocks.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_compat.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_completion.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_config.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_csv_table.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_direct.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_docx_tables.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_embedding.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_history.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_images.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_install_ocr.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_lookup.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_markdown_features.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_native.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_office.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_office_latex.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_packaging.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_pdf_input.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_polish.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_setup.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_soffice_parts.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_table_widths.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_tables.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_tessdata.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_text_input.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_translit.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_typst_input.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_unicode.py +0 -0
- {pdfmd_cli-3.25.20 → pdfmd_cli-3.26.20}/tests/test_versions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pdfmd-cli
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.26.20
|
|
4
4
|
Summary: One command from Markdown to a good-looking PDF: a Pandoc wrapper with smart defaults, project-file discovery and a multi-engine fallback chain
|
|
5
5
|
Author: Ali Perdekhan
|
|
6
6
|
License-Expression: MIT
|
|
@@ -233,6 +233,21 @@ MISS poppler: not found
|
|
|
233
233
|
brew install tesseract poppler
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
+
"Installed" is not "works": a LaTeX engine can be on the PATH and still fail on a missing package or font.
|
|
237
|
+
`pdfmd --doctor --deep` also builds a small page (maths, code, a table) with every engine it found, by running pdfmd
|
|
238
|
+
itself in a scratch folder, and says which one built it and how long that took, or why it could not:
|
|
239
|
+
|
|
240
|
+
```console
|
|
241
|
+
$ pdfmd --doctor --deep
|
|
242
|
+
...
|
|
243
|
+
Smoke test (a small page with maths, code and a table, built with each engine):
|
|
244
|
+
OK lualatex: built a PDF in 8.7 s
|
|
245
|
+
MISS xelatex: could not build it (! LaTeX Error: File `stix2.sty' not found.)
|
|
246
|
+
OK typst: built a PDF in 1.1 s
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
It takes a few seconds per engine (a minute or more if TeX has to fetch packages); without `--deep` nothing is built.
|
|
250
|
+
|
|
236
251
|
### Tab completion
|
|
237
252
|
|
|
238
253
|
`pdfmd --completion bash|zsh|fish` prints a completion script, generated from the command
|
|
@@ -368,6 +383,39 @@ letters, no tones, vowels left out where the script leaves them out. Names that
|
|
|
368
383
|
romanize alike (homophones) are listed as ambiguous, never picked between. The
|
|
369
384
|
same spelling rules find a section by its heading (`doc#tyche`).
|
|
370
385
|
|
|
386
|
+
### Check a document before you build it
|
|
387
|
+
|
|
388
|
+
```sh
|
|
389
|
+
pdfmd report --check # read report.md (a scaffold and its parts too) and list what is wrong; builds nothing
|
|
390
|
+
pdfmd a.md b.md --check # several files, one report each
|
|
391
|
+
pdfmd report --check --strict # warnings fail too (exit 1), for CI
|
|
392
|
+
pdfmd report --check --check-ignore heading-jump,link-missing
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
`--check` reads the source, with no Pandoc and no LaTeX, and prints compiler-style lines
|
|
396
|
+
(`report.md:12: error: image not found: figs/a.png [image-missing]`) that an editor can jump to, then
|
|
397
|
+
`CHECK report.md: 1 error(s), 2 warning(s)`. It exits 1 on an error, and on a warning too with `--strict`. It finds:
|
|
398
|
+
|
|
399
|
+
| check | |
|
|
400
|
+
|---|---|
|
|
401
|
+
| `image-missing`, `file-missing`, `link-missing` | an image (``, `<img>`, `\includegraphics`), a `file=` of a `.csv` div or a link to a local file that is not there |
|
|
402
|
+
| `anchor-missing` | `[x](#methods)` with no heading or `{#id}` of that name (the ids Pandoc and GitHub make from a heading count) |
|
|
403
|
+
| `id-duplicate`, `crossref-missing`, `ref-missing` | the same `{#id}` twice; a `@fig:x`, `@tbl:x`, `@eq:x`, `@sec:x`, `@lst:x` or `\ref{x}` nothing defines |
|
|
404
|
+
| `cite-missing`, `cite-no-bibliography`, `bibliography-missing` | a `@key` the `.bib`, CSL JSON or `references:` lacks (with a "did you mean"), citations with no bibliography set, a bibliography file that is missing |
|
|
405
|
+
| `footnote-missing`, `footnote-unused` | `[^1]` with no text, a `[^1]:` nobody uses |
|
|
406
|
+
| `heading-jump`, `heading-space`, `heading-empty` | `#` then `###`; `#Heading` (a paragraph); a heading with no text |
|
|
407
|
+
| `fence-open`, `comment-open`, `div-open`, `div-stray`, `math-open` | a code fence, `<!--`, `:::` div or `$$` that is never closed, or a stray `:::` |
|
|
408
|
+
| `front-matter`, `front-matter-duplicate` | YAML that does not parse (with its line) or never closes; a key set twice |
|
|
409
|
+
|
|
410
|
+
Code, comments, math and URLs are not read, so `@decorator` in a code block or `me@x.org` is not a citation. A
|
|
411
|
+
document in parts is checked as one: a link to `#methods` in the scaffold is found in a part. A file with no front
|
|
412
|
+
matter is taken for a fragment and its citations are not held against a missing bibliography, and neither are those of
|
|
413
|
+
a document with a Lua filter or `citation-engine` (something else may do the citing). A part checked on its own cannot
|
|
414
|
+
see the other parts' labels, so check the scaffold, not a part, to judge links across parts.
|
|
415
|
+
Leave a check out for the project with `pdfmd-options: {check-ignore: [heading-jump]}` (a document, a metadata file or
|
|
416
|
+
the config), or on one line with `<!-- pdfmd-check: ignore image-missing -->` on it or on the line above. `pdfmd --check`
|
|
417
|
+
is for Markdown; the build's own `WARN` and `--strict` still catch what only a build can see.
|
|
418
|
+
|
|
371
419
|
### A small editor
|
|
372
420
|
|
|
373
421
|
```sh
|
|
@@ -383,13 +431,50 @@ for the build, and a name that does not exist yet starts a new file. It is delib
|
|
|
383
431
|
|
|
384
432
|
### In VS Code
|
|
385
433
|
|
|
386
|
-
`pdfmd --init-vscode` writes a `.vscode/tasks.json` here (build, build and open, watch, extract tables; Terminal > Run
|
|
434
|
+
`pdfmd --init-vscode` writes a `.vscode/tasks.json` here (build, build and open, watch, check, extract tables; Terminal > Run
|
|
387
435
|
Build Task). The [`vscode/`](https://github.com/aliperdehan/pdfmd/tree/main/vscode) folder of the repository is a small
|
|
388
436
|
extension over the same command line: build (`Cmd/Ctrl+Alt+B`), build and open, build as Word/HTML/Typst/slides, extract
|
|
389
437
|
tables (all, or chosen ones), file history, compare and restore, restore the source a PDF carries (right-click it). Every
|
|
390
438
|
command it runs is written to the *pdfmd* output panel. Install it with `npx @vscode/vsce package` and
|
|
391
439
|
`code --install-extension pdfmd-vscode-*.vsix`.
|
|
392
440
|
|
|
441
|
+
### A size budget for images and output
|
|
442
|
+
|
|
443
|
+
```sh
|
|
444
|
+
pdfmd report --max-asset-mb 5 --max-output-mb 20 # warn about an image over 5 MB and an output over 20 MB
|
|
445
|
+
pdfmd report --check --max-asset-mb 5 # list the images over 5 MB (asset-large), nothing is built
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
```yaml
|
|
449
|
+
pdfmd-options:
|
|
450
|
+
max-asset-mb: 5 # one image or data file
|
|
451
|
+
max-output-mb: 20 # the file that is made (a mail server's limit, a course site's upload limit)
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
There is no budget unless one is set. With one, a build says which image is over it before it starts
|
|
455
|
+
(`WARN report.md: figs/scan.png is 14.2 MB, over the 5 MB asset budget`) and, when the file made is over the output
|
|
456
|
+
budget, names it and the three largest images behind it. They are `WARN` lines, so `--strict` fails them. `--max-asset-mb 0`
|
|
457
|
+
switches a document's budget off for one run.
|
|
458
|
+
|
|
459
|
+
### Start from a template
|
|
460
|
+
|
|
461
|
+
```sh
|
|
462
|
+
pdfmd --init # the templates: article, report, notes, slides, book, and yours
|
|
463
|
+
pdfmd --init article my-paper # my-paper/my-paper.md + refs.bib, title, author and date filled in
|
|
464
|
+
pdfmd --init report . # into this folder, if none of its files exist yet
|
|
465
|
+
pdfmd --init notes week3 -V author="A. Author" -V title="Week 3"
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Each template builds as it is (they are checked with `--check --strict` and built in the tests): an `article` with an
|
|
469
|
+
abstract, an equation, a table and a citation with its `.bib`; a `report` with a contents page, numbered sections and a
|
|
470
|
+
table read from a CSV file; `notes` (headings, math, a code block); `slides` (build with `-p`); and a `book`, a scaffold
|
|
471
|
+
with its chapters in `parts/`. The title comes from the name, the author from `-V author=` or `git config user.name`.
|
|
472
|
+
Nothing that exists is overwritten: pdfmd names the files in the way and writes nothing. Your own templates are a
|
|
473
|
+
folder (or a single `.md` file) in the `templates/` folder of pdfmd's config folder (`pdfmd --init` shows where), or any
|
|
474
|
+
folder or `.md` file named by its path. In their files and file names `{{name}}`, `{{title}}`, `{{author}}`, `{{date}}`
|
|
475
|
+
and `{{year}}` are replaced (`__name__.md` becomes `my-paper.md`); any other `{{...}}` stays as written. A
|
|
476
|
+
`description.txt` (one line, for the list) and a `next.txt` (what to type next) in a template folder are not copied.
|
|
477
|
+
|
|
393
478
|
### One section
|
|
394
479
|
|
|
395
480
|
`pdfmd doc#onlyapart` builds just the section whose heading is "Only a Part"
|
|
@@ -417,6 +502,113 @@ pdfmd lecture --to typst -o lecture.typ
|
|
|
417
502
|
pdfmd lecture -o lecture.tex # a complete, compilable .tex, not a fragment
|
|
418
503
|
```
|
|
419
504
|
|
|
505
|
+
### Plain Markdown: `--to gfm`
|
|
506
|
+
|
|
507
|
+
```sh
|
|
508
|
+
pdfmd report --to gfm # report.gfm.md, beside report.md, never over it
|
|
509
|
+
pdfmd report --to gfm -o README.md
|
|
510
|
+
pdfmd report --to gfm+raw # Pandoc's own gfm writer, with its HTML, as it was
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
`--to gfm` writes Markdown that any viewer shows as it is (GitHub, VS Code, Obsidian, a chat window): no HTML, no
|
|
514
|
+
`{#id .class}` braces, no Pandoc-only syntax. pdfmd runs everything it runs for any other target first (includes, parts,
|
|
515
|
+
`::: {.csv}` tables, pandoc-crossref, citations, your filters), then flattens what is left:
|
|
516
|
+
|
|
517
|
+
- the title block is written (`# Title`, an `*Author, Author — date*` line, the abstract), since the front matter is not;
|
|
518
|
+
- a table caption becomes `**Table 1.** text` above the table, a figure caption the same below the figure (the label
|
|
519
|
+
is split at the number pandoc-crossref wrote, in any language); `{#tbl:x}` and `{#fig:x}` are gone;
|
|
520
|
+
- `<div>`, `<span>`, `<figure>` and the bibliography's wrappers are unwrapped; section numbers (`number-sections`) are
|
|
521
|
+
written into the headings; a link to a heading points at the anchor GitHub gives it, a link to a vanished id is text;
|
|
522
|
+
- subscripts and superscripts are Unicode where every character has one (`H₂O`, `x²`, `CO₃²⁻`) and `_(..)` / `^(..)`
|
|
523
|
+
where not (`--gfm-scripts unicode`, the default; `html` keeps `<sub>`, `drop` writes the plain text, `ascii` always
|
|
524
|
+
writes `_2`, `^(q+z)`); math stays `$..$` and `$$..$$` (`--gfm-math fenced` writes ```` ```math ````);
|
|
525
|
+
- raw HTML and raw LaTeX are read into Markdown (`<b>x</b>` becomes `**x**`, `\textbf{x}` too); a raw Typst piece, a LaTeX
|
|
526
|
+
picture (`tikzpicture`, `\chemfig`, drawn with your preamble), a PDF image and an `<img src="x.pdf">` become SVG files in
|
|
527
|
+
`<name>_files/` beside the output, linked relatively;
|
|
528
|
+
- definition lists become a bold term and a paragraph; a table Markdown cannot hold (spans, several header rows, block
|
|
529
|
+
cells) is written as an HTML table, the one piece of HTML that stays, and counted in a `NOTE`;
|
|
530
|
+
- what no Markdown can carry (Word XML, a LaTeX macro nothing read) is left out, and a `WARN` counts it and shows the
|
|
531
|
+
first.
|
|
532
|
+
|
|
533
|
+
```yaml
|
|
534
|
+
pdfmd-options:
|
|
535
|
+
gfm: {scripts: unicode, math: dollars, title: true}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
`-o notes.gfm.md` is `--to gfm` (it is also the name a flat file gets by default from `notes.md`); `-o notes.md` alone still means Pandoc's Markdown, so name the target (`--to gfm -o notes.md`) to get the flat one under that name. The paragraphs are single lines (`--wrap=none`; pass `--wrap=auto` to Pandoc to change it). Image links stay as the document wrote them, relative to the document's folder (a `NOTE` says so when the output is written elsewhere). The result is meant to be
|
|
539
|
+
final: what the flattening removes (ids, cross-reference numbers become text, citations become text) is not recoverable
|
|
540
|
+
from it.
|
|
541
|
+
|
|
542
|
+
#### The flat file that carries its source: `--keep-source`
|
|
543
|
+
|
|
544
|
+
Flattening cannot be undone (ids, cross-reference numbers, citations and scripts are text now). So a Markdown output
|
|
545
|
+
can end with its whole source in one HTML comment, the same set of files `--attach-source` puts into a PDF (the
|
|
546
|
+
assembled Markdown, a manifest of the layout, the `.csv` data), and `--restore` writes them back:
|
|
547
|
+
|
|
548
|
+
```sh
|
|
549
|
+
pdfmd report --to gfm --keep-source # report.gfm.md ends with the source, compressed (packed)
|
|
550
|
+
pdfmd report --to gfm --keep-source readable # the same, as escaped text you can read and diff
|
|
551
|
+
pdfmd --restore report.gfm.md --list # what it carries
|
|
552
|
+
pdfmd --restore report.gfm.md # writes report.gfm.restored/ (never overwrites anything)
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
```yaml
|
|
556
|
+
pdfmd-options:
|
|
557
|
+
keep-source: true # or readable; --no-keep-source turns it off for a run
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
Nothing in the source can close the comment early: `packed` is base64 of the compressed source (no `-`, `<` or `>`
|
|
561
|
+
in it), `readable` escapes every `>` (so no `-->` or `--!>`), a backslash, a carriage return and a line-initial `<` or `=`,
|
|
562
|
+
and undoes it exactly. A source with `<!-- a <!-- b --> c -->`, `-->` in a code block, CRLF line endings or the marker
|
|
563
|
+
itself comes back byte for byte. The comment also stores a hash of the Markdown above it, so `--restore` can tell
|
|
564
|
+
you the file was edited since. Comments are stripped from the kept copy unless `strip-comments` says otherwise (as for
|
|
565
|
+
`--attach-source`); a whole build keeps its source, a part or a section built alone does not; a kept source over 1 MB
|
|
566
|
+
gets a warning, since GitHub stops showing a Markdown file that large. It works for every Markdown output: `--to gfm`,
|
|
567
|
+
`gfm+raw`, `markdown`, `commonmark`.
|
|
568
|
+
|
|
569
|
+
### Plain text: `--to txt`
|
|
570
|
+
|
|
571
|
+
```sh
|
|
572
|
+
pdfmd report --to txt # report.txt; the same as -o report.txt
|
|
573
|
+
pdfmd report --to txt --columns=100 # Pandoc's wrapping, 72 columns unless you say otherwise
|
|
574
|
+
pdfmd report --to plain # Pandoc's own plain writer, as it was
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
`--to txt` is the flat build of `--to gfm` written by Pandoc's plain writer: includes, parts, `::: {.csv}` tables,
|
|
578
|
+
pandoc-crossref, citations, raw HTML and LaTeX and your filters all run first. What a text file shows: the title, the
|
|
579
|
+
author line and the abstract, then headings underlined with `=` (level 1) and `-` (level 2) and numbered when the
|
|
580
|
+
document numbers its sections; `Table 1. caption` above a table and `[Figure 1. caption]` for a figure; a link as
|
|
581
|
+
`words <https://address>` (just the words when they are the address, or the link points into the document); no `**` or
|
|
582
|
+
`_`; Unicode sub/superscripts (`H₂O`, `x²`, else `_(..)` / `^(..)`; `--gfm-scripts drop` or `ascii` change that, `html`
|
|
583
|
+
means `unicode` here); math as Pandoc's plain writer sets it (`E = mc²`). A picture cannot be shown: its caption stands
|
|
584
|
+
for it, and a Typst or LaTeX picture piece is left out with a `WARN`. `pdfmd-options: {txt: {scripts: unicode, title:
|
|
585
|
+
true}}` holds the settings. Until 3.26.7 `--to txt` and `-o x.txt` meant Pandoc's own plain writer; that is `--to plain`.
|
|
586
|
+
|
|
587
|
+
### ASCII only: `--to ascii`
|
|
588
|
+
|
|
589
|
+
```sh
|
|
590
|
+
pdfmd report --to ascii # report.ascii.txt: no byte above 127
|
|
591
|
+
pdfmd report --to ascii:gfm # report.ascii.gfm.md (also ascii:markdown, commonmark, rst, org, asciidoc, plain)
|
|
592
|
+
pdfmd report -o notes.ascii.txt # the name asks for it, as notes.gfm.md asks for --to gfm
|
|
593
|
+
pdfmd report -o notes.ascii.rst # any text ending after .ascii: .gfm.md, .md, .rst, .org, .adoc
|
|
594
|
+
pdfmd report --to ascii --ascii-missing escape # what has no ASCII form: \u65e5 instead of ?
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
For a terminal, an old mail gateway, a legacy system. The build is that of the format after the colon (`txt` when there
|
|
598
|
+
is none), with the words mapped to ASCII before the writer sees them, so the writer escapes what the new spelling needs:
|
|
599
|
+
a `−` at the start of a line that becomes `-` is written `\-`, not taken for a list; a table's columns are measured on the
|
|
600
|
+
ASCII text. What is mapped, in this order: punctuation and spaces (curly quotes, `—` as `--`, `…` as `...`, no-break
|
|
601
|
+
spaces, soft hyphens), symbols (`≤` `<=`, `±` `+/-`, `→` `->`, `°` `deg`, `½` `1/2`, `©` `(c)`), Greek letters by name
|
|
602
|
+
(`α` `alpha`, `Δ` `Delta`, `μm` `um`; a Greek word is spelt: `Σοφία` `Sophia`), Cyrillic with its case (`Привет`
|
|
603
|
+
`Privet`), accents (`é` `e`, `ß` `ss`, `ł` `l`), subscripts and superscripts (`H_2O`, `x^2`, `CO_3^(2-)`; `--gfm-scripts
|
|
604
|
+
drop` writes `H2O`), then the romanization packs for Hebrew, Arabic, Armenian, Georgian, Korean and Japanese kana, and
|
|
605
|
+
Chinese and the rest when `pypinyin` or `anyascii` is installed (`pdfmd --install translit`). Math stays TeX, with macros
|
|
606
|
+
(`$\alpha \geq 2$`); a link's address is percent-encoded (`%C3%A9`), not spelt. A character with no ASCII form is
|
|
607
|
+
counted and named in a `WARN`, and written as `?` (`--ascii-missing question`, the default), as `\uXXXX` (`escape`), as
|
|
608
|
+
nothing (`drop`), or the file is not written at all (`fail`); `pdfmd-options: {ascii: {missing: escape}}` sets it per
|
|
609
|
+
document. `--keep-source` on an ASCII file keeps the source packed (the readable form would be Unicode). It applies to text
|
|
610
|
+
formats only: `--to ascii:docx` is refused.
|
|
611
|
+
|
|
420
612
|
### Word and OpenDocument output
|
|
421
613
|
|
|
422
614
|
Plain Pandoc ignores `papersize`, `geometry`, `mainfont` and `fontsize` when it writes `.docx`
|
|
@@ -851,7 +1043,31 @@ The parts are joined in filename order into one Pandoc run, so the result is
|
|
|
851
1043
|
identical to the same text in a single file: labels, citations and numbering
|
|
852
1044
|
work across parts, and paths are written relative to the scaffold's folder
|
|
853
1045
|
whichever part they are in. A part rebuilt alone is much faster to compile
|
|
854
|
-
|
|
1046
|
+
and still shows the numbers of the others: before it is typeset, pdfmd has
|
|
1047
|
+
Pandoc write the LaTeX of the whole document once more (about a second, no
|
|
1048
|
+
images, no engine), reads which headings, captions, equations and labels it
|
|
1049
|
+
holds, and has LaTeX replay them at the start of the part. A reference to a
|
|
1050
|
+
section, figure, table or equation outside the part then prints its number
|
|
1051
|
+
(`Section 2`, `Equation (3)`, a `\cref` too), in the document's own number style
|
|
1052
|
+
(Roman sections, numbers per chapter), as a link that leads nowhere; the part's
|
|
1053
|
+
own sections, figures and equations continue from the parts before it. What the
|
|
1054
|
+
scan cannot count is whatever the document defines itself (a macro that opens
|
|
1055
|
+
a figure, say): that label stays `??`, and the build says the numbers are
|
|
1056
|
+
approximate. `\pageref` is always `??`. The last full build's `.aux` (cache on,
|
|
1057
|
+
below) is exact and is used first; the scan fills in what it does not know.
|
|
1058
|
+
`pdfmd-options: {seed-labels: auto|aux|scan|draft|off}` or `--seed-labels` picks
|
|
1059
|
+
the source (`draft` runs LaTeX once over the whole document without output, for
|
|
1060
|
+
exact numbers at about half a compile's cost); `off` brings back the `??`. A section of an ordinary document
|
|
1061
|
+
(`doc#results`) gets the same for the references it makes, but keeps numbering
|
|
1062
|
+
its own headings from 1.
|
|
1063
|
+
|
|
1064
|
+
For HTML, EPUB, Word, OpenDocument, Typst and PDF through an engine that is not LaTeX the
|
|
1065
|
+
same idea works differently: pdfmd hands Pandoc the whole document with each part in a
|
|
1066
|
+
marked div, lets pandoc-crossref number and resolve everything, and then keeps only the
|
|
1067
|
+
part you asked for (`select.lua`). Its headings, figures, tables and equations keep the
|
|
1068
|
+
full document's numbers, and `[@sec:x]`, `[@fig:y]` to the rest resolve (as links that
|
|
1069
|
+
lead nowhere). Raw LaTeX `\ref{..}` is a LaTeX-only reference: use pandoc-crossref's
|
|
1070
|
+
syntax for those writers. See
|
|
855
1071
|
[`examples/parts/`](https://github.com/aliperdehan/pdfmd/tree/main/examples/parts/).
|
|
856
1072
|
|
|
857
1073
|
#### Faster rebuilds: the cache
|
|
@@ -863,8 +1079,9 @@ pdfmd-options:
|
|
|
863
1079
|
|
|
864
1080
|
keeps LaTeX's cross-reference files between builds (in `~/.cache/pdfmd`), so
|
|
865
1081
|
an unchanged document is typeset once instead of two or three times, and a
|
|
866
|
-
part built on its own shows the
|
|
867
|
-
from the last full build
|
|
1082
|
+
part built on its own shows the exact numbers of the parts left out (taken
|
|
1083
|
+
from the last full build; without the cache they are counted from the
|
|
1084
|
+
sources, above). It never skips a build: Pandoc and
|
|
868
1085
|
LaTeX still process the whole document from the current sources and package
|
|
869
1086
|
every time, so a change shows in the next build. `cache: {plots: true}` (or
|
|
870
1087
|
`--cache-plots`, with nulabreport >= 1.26.0) additionally stores each plot as a
|
|
@@ -995,6 +1212,37 @@ badge works, and a Pandoc built without HTTP support (Homebrew's is) no longer d
|
|
|
995
1212
|
warning and the image's description stays. `--no-auto svg` and `--no-auto remoteimages` turn the two off, and
|
|
996
1213
|
`pdfmd --doctor` says which converter will be used.
|
|
997
1214
|
|
|
1215
|
+
### Diagrams written as code
|
|
1216
|
+
|
|
1217
|
+
````markdown
|
|
1218
|
+
```mermaid
|
|
1219
|
+
graph LR; Sample --> Reaction --> Product
|
|
1220
|
+
```
|
|
1221
|
+
|
|
1222
|
+
```{.dot #fig:flow caption="The *flow* of the experiment" width=60% engine=neato}
|
|
1223
|
+
digraph { sample -> reaction -> product }
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
```d2
|
|
1227
|
+
sample -> reaction -> product
|
|
1228
|
+
```
|
|
1229
|
+
````
|
|
1230
|
+
|
|
1231
|
+
A fenced block whose class is `mermaid`, `d2`, `dot` or `graphviz` is drawn by the tool that reads that language and the
|
|
1232
|
+
picture takes its place: [Graphviz](https://graphviz.org) (`dot`), [D2](https://d2lang.com) (`d2`) and
|
|
1233
|
+
[Mermaid](https://github.com/mermaid-js/mermaid-cli) (`mmdc`). pdfmd asks each for the format the output takes: a PDF
|
|
1234
|
+
for LaTeX, an SVG for HTML (inside the file, so it can be sent on its own) and Typst (a PNG for Mermaid, whose SVG
|
|
1235
|
+
Typst cannot show), a PNG for Word and OpenDocument, and for flat Markdown (`--to gfm`) an SVG in the `_files/` folder
|
|
1236
|
+
beside the output, except a Mermaid block, which stays as it is because GitHub draws it. A text output keeps the source.
|
|
1237
|
+
Drawings are kept in the cache by their content, so a rebuild does not draw them again. `caption="..."` makes a figure
|
|
1238
|
+
(`{#fig:id}` with pandoc-crossref numbers it), `width=` sizes it, `engine=` picks the Graphviz layout (`dot`, `neato`,
|
|
1239
|
+
`fdp`, `sfdp`, `circo`, `twopi`), `theme=` the Mermaid theme, `layout=` the D2 layout (`dagre`, `elk`). A tool that is
|
|
1240
|
+
not installed leaves the block as code with one warning (`--strict` makes it an error) and says how to install it;
|
|
1241
|
+
a diagram the tool cannot parse stays as code too. `pdfmd --doctor` shows which tools are there, and
|
|
1242
|
+
`--no-auto diagrams` turns the whole thing off. The attributes need Pandoc's Markdown (a file with front matter); a file
|
|
1243
|
+
read as gfm takes the plain ```` ```dot ```` form. Mermaid needs Chrome (mermaid-cli downloads one); in a sandbox
|
|
1244
|
+
`PDFMD_MMDC_CONFIG=puppeteer.json` is handed to `mmdc -p`.
|
|
1245
|
+
|
|
998
1246
|
### Editable in LibreOffice, and one file that carries its data
|
|
999
1247
|
|
|
1000
1248
|
`--hybrid` makes the PDF a LibreOffice *hybrid PDF*: besides its pages it carries an OpenDocument copy of the document
|
|
@@ -1040,7 +1288,10 @@ vector picture, a PDF for LaTeX, Typst and Word, an SVG for HTML. A syntax a fam
|
|
|
1040
1288
|
included, which is odd but a clear way to say "this output has no HTML in it". A family not mentioned is left to Pandoc
|
|
1041
1289
|
as it always was, `raw: all` lists everything, and `--no-raw` turns it off for a run. Pictures are kept in pdfmd's cache by
|
|
1042
1290
|
their content. (An HTML file that is not self-contained points at the cache; use `--self-contained` to carry them.)
|
|
1043
|
-
|
|
1291
|
+
A LaTeX picture Pandoc cannot read (a `tikzpicture`, `circuitikz`, `pgfpicture`, `forest`, `\chemfig`...) is drawn by a LaTeX
|
|
1292
|
+
engine with the `standalone` class, after the document's own preamble and `header-includes`, and placed as a vector picture
|
|
1293
|
+
in HTML, Typst and flat Markdown builds (an SVG for HTML and Markdown; a piece that does not compile is reported and left
|
|
1294
|
+
out). Not yet: HTML drawn as a picture, Word XML as
|
|
1044
1295
|
anything but Word XML.
|
|
1045
1296
|
|
|
1046
1297
|
**PDF images in HTML.** A browser does not show a PDF in `<img>`, an SVG it does. For an HTML build (a web page, an
|
|
@@ -1090,7 +1341,7 @@ Most of these print an `AUTO` line, and each can be switched off individually.
|
|
|
1090
1341
|
|
|
1091
1342
|
| `AUTO` kind | When | What happens |
|
|
1092
1343
|
|---|---|---|
|
|
1093
|
-
| `READER` | a Markdown file with no YAML front matter | reads the file as GitHub-flavoured Markdown (content-sized table columns, relaxed blank-line rules) |
|
|
1344
|
+
| `READER` | a Markdown file with no YAML front matter | reads the file as GitHub-flavoured Markdown (content-sized table columns, relaxed blank-line rules). If the file uses what only Pandoc's Markdown reads (`H~2~O`, `x^2^`, `{#id}` attributes, raw LaTeX, fenced divs), a `NOTE` says gfm leaves it as text; `--from markdown`, a front-matter block, or `reader:` below changes it |
|
|
1094
1345
|
| `TITLE` | a Markdown file with no front matter, first line is `# Title` | that heading becomes the document title, and the remaining headings move up one level |
|
|
1095
1346
|
| `MARGIN` | no margin or geometry set anywhere | 1-inch margins instead of LaTeX's wide defaults |
|
|
1096
1347
|
| `MAINFONT` | no `mainfont:` and no `-f` | STIX Two Text (Times New Roman if it isn't installed), or a serif that has the letters when the document is mostly in a script STIX Two Text lacks (Kazakh Cyrillic, say); retried with DejaVu Serif if a glyph is still missing. A font you name is never changed except by `fallback: document` |
|
|
@@ -1115,7 +1366,7 @@ AUTO READER lecture.md: no YAML front matter; reading as gfm
|
|
|
1115
1366
|
AUTO TITLE lecture.md: promoted leading '# ' heading to Pandoc title metadata
|
|
1116
1367
|
AUTO MARGIN lecture.md: no geometry/margin set; using geometry:margin=1in on LaTeX-family engines
|
|
1117
1368
|
AUTO MONOFONT lecture.md: has code but no monofont set; using JetBrains Mono on LaTeX-family engines
|
|
1118
|
-
OK lecture.md
|
|
1369
|
+
OK lecture.md (lualatex)
|
|
1119
1370
|
```
|
|
1120
1371
|
|
|
1121
1372
|
The second `CMD` line is the font fallback at work: STIX Two Text was
|
|
@@ -1125,6 +1376,24 @@ file paths are shortened here.)
|
|
|
1125
1376
|
**When a PDF doesn't look the way the Markdown suggests, run `-v` first.**
|
|
1126
1377
|
The cause is usually one of these automatic decisions, and `-v` names it.
|
|
1127
1378
|
|
|
1379
|
+
The closing line also names the engine that made the PDF. If an earlier one failed, the line says so, so a
|
|
1380
|
+
build that quietly fell back to Typst does not look like one that did not:
|
|
1381
|
+
|
|
1382
|
+
```console
|
|
1383
|
+
$ pdfmd paper
|
|
1384
|
+
WARN paper.md: lualatex failed (! Undefined control sequence.); trying xelatex...
|
|
1385
|
+
WARN paper.md: xelatex failed (! Undefined control sequence.); trying typst...
|
|
1386
|
+
OK paper.md (typst; lualatex, xelatex failed)
|
|
1387
|
+
```
|
|
1388
|
+
|
|
1389
|
+
When LaTeX itself stops, the warning also says where: Pandoc reports a line of the LaTeX it wrote, so pdfmd finds those
|
|
1390
|
+
words in your Markdown and prints `near line 9 of paper.md: ...has \badmacro`.
|
|
1391
|
+
|
|
1392
|
+
`--strict` (or `pdfmd-options: {strict: true}` in the document; `--no-strict` overrides it) makes that, and every other
|
|
1393
|
+
warning, an error for scripts and CI: a file whose build printed a `WARN` line, or about which Pandoc warned (an image
|
|
1394
|
+
or citation it could not find, a LaTeX reference left undefined), is reported `FAIL` with the first warnings listed and
|
|
1395
|
+
the exit code is 1. The output file is kept. In a batch only that file fails.
|
|
1396
|
+
|
|
1128
1397
|
### Other scripts
|
|
1129
1398
|
|
|
1130
1399
|
<p align="center">
|
|
@@ -1238,6 +1507,10 @@ pdfmd-options:
|
|
|
1238
1507
|
---
|
|
1239
1508
|
```
|
|
1240
1509
|
|
|
1510
|
+
`reader:` fixes the Pandoc reader of a Markdown file (`markdown`, `gfm`, `commonmark_x`, ...; `auto` is the default
|
|
1511
|
+
choice described under *What it does automatically*). It is `--from` for one document, or for a whole folder or all your
|
|
1512
|
+
documents when it sits in `metadata.yaml` or the config file's `options:`.
|
|
1513
|
+
|
|
1241
1514
|
`pdf-engine:` takes an engine name (`lualatex`, `typst`, ...) or a family:
|
|
1242
1515
|
`tex`, `typst`, `html` or `office`. A family limits the fallback chain to
|
|
1243
1516
|
that kind of engine. For example, a document full of chemical structures
|
|
@@ -1311,6 +1584,14 @@ With a `metadata/` folder, a report's own folder can hold nothing but
|
|
|
1311
1584
|
`bibliography: refs.bib`) resolve from `metadata/`, and image paths in the
|
|
1312
1585
|
document still resolve from the document's own folder.
|
|
1313
1586
|
|
|
1587
|
+
**A Lua filter can run any command**, so pdfmd tells you about the ones it picks up by itself. The first build with a
|
|
1588
|
+
`<name>.lua` (or `nulabreport.lua`) it has not run before prints one `NOTE`, and so does the first build after the file
|
|
1589
|
+
changed; the filter runs all the same, and there is never a prompt, so a filter you edit every day, `-j`, `-w`, CI and the
|
|
1590
|
+
Python API are not held up. `pdfmd --trust-lua ~/work/reports` marks a folder you work in (or one filter, as it is now):
|
|
1591
|
+
nothing under it is noted again. Only `--strict` skips a new or edited filter outside such a folder. pdfmd remembers
|
|
1592
|
+
each filter's path and SHA-256 in `known-lua.txt` beside its config. This is a notice, not a lock: it does not protect
|
|
1593
|
+
the first build of a folder you have just downloaded, so read its `.lua` first.
|
|
1594
|
+
|
|
1314
1595
|
One shared metadata file can also be **symlinked** into many folders. A
|
|
1315
1596
|
relative `bibliography: refs.bib` inside it then finds the `refs.bib`
|
|
1316
1597
|
next to the file's real copy, so you never need an absolute path.
|