Andy Kopra 4a4c7404cc Markdown to PDF: the mdpdf command, and the fonts it needs
This snapshot carries sks/tns/, the translation directory, into the
distribution for the first time, together with the two default font
families its stylesheet names.

sks/tns/ holds two converters in opposite directions.  md_to_sks.py
converts Markdown to Klammertext, recording what it cannot convert exactly
as "#[MD ... ]#" markers so a draft carries its own worklist.  md_to_pdf.py
renders Markdown straight to PDF through a headless Chromium driven over the
DevTools Protocol, bypassing Klammertext entirely -- the route for a
document that is not ready to convert, and a permanent one for Markdown that
Klammertext cannot represent well.  Neither is loaded by the SKS; md_to_pdf
needs markdown-it-py, which it keeps in a virtual environment of its own and
creates with --setup.

The everyday form of the second is the mdpdf command, a shell function in
sks/tns/mdpdf.sh that env/runtime.env sources, so anyone with the
Klammertext environment has it:

    mdpdf notes.md          # writes notes.pdf beside it

It supplies the house fonts, the size matching, and the code wrapping,
completes on *.md at the TAB key, and takes its defaults from MDPDF_*
variables so one can be changed in a shell profile without copying the
function.  It is POSIX shell rather than zsh, since runtime.env is sourced
from bash profiles too.

Two things the stylesheet does that a print stylesheet usually cannot.  Code
lines are wrapped to a column count MEASURED from the rendered page rather
than written down -- the browser is asked how many characters a code box
holds, over every box in the document, so the wrapping stays right when the
fonts, sizes or margins change.  And the page number is a CSS Paged Media
margin box, which current Chromium implements, so it is set in the
document's own face instead of the browser's generic sans.

fnt/ gains EB Garamond and Source Sans 3, the serif and sans the stylesheet
asks for by default.

 (from dev 97d4f244c737)
2026-08-09 15:54:05 +02:00

Klammertext

Klammertext is a markup language that produces multiple output formats — HTML, LaTeX/PDF, and plain text — from a single source description. Its core engine, the Klammermachine, is written in C++; the Standard Klammer Set (SKS) adds a default library of formatting and document-structuring operators on top.

Installing

Installation guides are in doc/install/:

  • Linux, from source — doc/install/linux_source_install.md
  • macOS, from source — doc/install/macos_source_install.md
  • Linux, container — doc/install/linux_container_install.md
  • macOS, container — doc/install/macos_container_install.md

Building from source

With a C++20 compiler and KLAMMERTEXT_HOME set to this directory:

make -C com

This builds the Klammermachine library (into lib/), the SKS components, and the three commands — ktext, kdesc, kdiag (into bin/). See the source-install guide for prerequisites (TeX Live for PDF output, Python, and so on).

Editor support

Editing support for Emacs, Sublime Text, Vim, and Visual Studio Code — syntax highlighting, delimiter matching, structural reindentation, table alignment, diagnostics — is in doc/edit/, together with the shared implementation and the Klammertext language server they build on.

Provenance

This repository is a curated snapshot of Klammertext's private development tree, assembled by a manifest-driven script. Its history is a series of release snapshots, not a mirror of the development history, and files here are regenerated on each release — patches cannot be merged directly. Report problems (or send patches) to the author; accepted changes are applied to the development tree and appear in a following snapshot.

This snapshot was assembled from development commit 97d4f244c737.

License

See LICENSE.md.

Description
No description provided
Readme 5.1 MiB
Languages
C++ 52%
Python 21%
Shell 14.5%
JavaScript 5.5%
CSS 2.9%
Other 4%