2 Commits

Author SHA1 Message Date
bd39d9a369 Literal @c, @source_listing with :marker, and a large-directory speedup
Three changes.

@c now takes its content literally, like @code -- it is the inline form
and @code the block form of the same thing.  The named close "c@" is
required, and characters that are special in a target no longer break
the file: @c a_b c@ renders correctly everywhere.  The Markdown
converter stops quoting inline code, since nothing needs protecting.

@source_file is renamed @source_listing.  Code read from a file is its
own klammer; @code is only for a block written inline (its never-
implemented :filename and :pattern options are removed).  The new
:marker P option lists the region between two lines that are exactly
//P, so the source file declares its own extractable regions.  A marker
missing or not appearing exactly twice is an error, never a fallback.

Rendering a document that sits in a large directory was paying a
recursive walk of that directory's whole tree on every @eval -- 27
seconds for a document that renders in a third of one.  The walk is now
a non-recursive look decided once per directory.

Assembled from dev commit 071b1b183de4.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-16 16:58:50 +02:00
8b38a34841 A reference for an LLM assistant: doc/klammertext_for_llm.md
If you use a language model to help write Klammertext, give it this file.  It is
a dense reference written for a model rather than a person -- not a tutorial,
and it motivates nothing.

Two things make it different from the other documents here.

It tells the model NOT TO GUESS.  Its first section maps questions to commands,
because "kdesc" prints the live state of the machine's data structures: what
klammers exist, what arguments each takes, what the argument types accept.  The
file says outright that the parameter list kdesc prints is authoritative and
that the file is not, so a model checks rather than infers.  "kdiag --process
--check doc.kt" verifies a document without rendering it, and "kdiag --type"
settles how a fragment is being parsed.

Its second section is a table of WRONG ASSUMPTIONS.  A model that has not seen
Klammertext pattern-matches it to LaTeX, Markdown or Lisp and produces
confidently wrong syntax, so each row names the likely wrong guess and corrects
it -- braces against the bar separator, bracketed options against ":name value",
"%" against "#", backslash escapes against "^", and @document's body belonging
in its ":text" option rather than in a positional argument.

The rest is the syntax proper: the three "@" tiers, argument forms, a complete
worked document, the klammers most used when authoring, how to define one, and
the behaviour that otherwise costs a debugging session.

The README points at it.

Assembled from dev commit 6c2ff7b8fce3.
2026-08-16 13:19:34 +02:00