Package atessera.markdown


package atessera.markdown
Provides the Markdown processing subsystem for Alpha Tessera Base.

This package extends the commonmark-java library with custom AST nodes, block parsers, inline link processors, and renderers that target both LaTeX and HTML output. It is the core of the text-to-document pipeline, sitting between the raw Markdown input and the format-specific translators in atessera.publ.

Architecture

The package is organized into several subpackages, each handling a distinct concern:

blocks
Custom AST node types that extend commonmark-java's CustomBlock and CustomNode. These represent domain-specific constructs such as bibliography items, labels, math expressions, cross-references, citations, and advanced images.
parsers
Custom BlockParserFactory implementations that recognize the extended syntax (e.g. *** [#key], @@ label @@, > [||] caption) and produce the corresponding atessera.markdown.blocks nodes.
renderers
Custom NodeRenderer implementations that convert the extended AST nodes into LaTeX or HTML output. These are the rendering backends used by LatexTarget and HtmlTarget.
tex
A standalone LaTeX rendering pipeline (independent of commonmark-java's built-in renderers). Includes TexRenderer (the top-level renderer), CoreRenderer (handles standard Markdown nodes), and TexWriter (buffered output with LaTeX-specific conveniences).
cust
Customized inline parsing infrastructure. Includes a modified InlineParserImpl that extends commonmark-java's inline parser with support for additional delimiter processors and link markers, and a StaggeredDelimiterProcessor that dispatches delimiter runs to multiple processors based on run length.

Key top-level classes

LatexTarget
Configurable Markdown-to-LaTeX pipeline. Wraps a Parser and a TexRenderer, with feature flags to enable citations, labels, math, references, and advanced images. Provides convenience methods parse(String) and parse(List<String>).
HtmlTarget
Configurable Markdown-to-HTML pipeline. Wraps a Parser and an HTML renderer with feature flags for extended character processing, citations, labels, math, references, and advanced images. Supports splitting output at chapter boundaries and translating references via RefTranslation.
Renderers
Interface defining the contract for rendering all custom AST node types. Implemented by RenderersBase (provides default toString()-based rendering) and overridden by domain-specific targets.
EnumNodes
A utility for depth-first traversal of the AST, applying a Consumer to every node. Used extensively for collecting bibliography items and citation definitions after parsing.

Link processors

Several LinkProcessor implementations intercept inline link syntax ([text]) and reinterpret it based on the text prefix:

Data flow

 Markdown text
     │
     ▼
 LatexTarget / HtmlTarget
     │
     ├──► Parser (commonmark-java + custom block parsers + link processors)
     │
     ▼
 AST (commonmark nodes + custom blocks/nodes from atessera.markdown.blocks)
     │
     ▼
 Renderer (CoreRenderer + TexNodeRenderer / HtmlNodeRenderer)
     │
     ▼
 LaTeX / HTML output
 
See Also: