# sekaiarendelle/pltxt2htm architecture

> Architecture diagram of the GitHub repository sekaiarendelle/pltxt2htm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sekaiarendelle/pltxt2htm
- Repository: https://github.com/sekaiarendelle/pltxt2htm

## Overview

pltxt2htm is a header-only C++ library that converts Quantum-Physics text to HTML, with console, browser, and language-binding entry points. The main workflow accepts text and context, parses formatting into an AST, optimizes it, and renders a target-specific result. The README documents Markdown, LaTeX, Quantum-Physics tags, and macros as supported formatting capabilities. The tree and excerpts do not expose the parser and renderer implementation files, so those subsystem nodes use the existing include/pltxt2htm directory; their documented connections are cited to the README.

Main entry points: [`include/pltxt2htm`](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm) (Text parser), [`c/src/pltxt2htm.cc`](https://github.com/sekaiarendelle/pltxt2htm/blob/main/c/src/pltxt2htm.cc) (C API), [`cmd/pltxt2htm.cc`](https://github.com/sekaiarendelle/pltxt2htm/blob/main/cmd/pltxt2htm.cc) (Console CLI), [`py/pltxt2htm.cc`](https://github.com/sekaiarendelle/pltxt2htm/blob/main/py/pltxt2htm.cc) (Python binding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_console["Console CLI<br/>[pltxt2htm.cc]"]
  node_c_api["C API<br/>[pltxt2htm.cc]"]
  node_python["Python binding<br/>[pltxt2htm.cc]"]
  node_rust["Rust binding<br/>[lib.rs]"]
  node_wasm["WebAssembly binding<br/>[pltxt2htm.cc]"]
end

subgraph group_parse["Parsing"]
  node_text["Quantum text"]
  node_markdown["Markdown syntax"]
  node_latex["LaTeX syntax"]
  node_qp_tags["Physics tags"]
  node_macros["Context macros"]
  node_parser["Text parser"]
  node_ast["Parsed AST"]
end

subgraph group_render["Rendering"]
  node_optimizer["AST optimizer"]
  node_common_html["Common HTML"]
  node_fixedadv_html["Fixed-adv HTML"]
  node_plunity["Unity text"]
  node_html["HTML output"]
end

node_user(("Text consumer"))

node_user -.->|"submits text"| node_console
node_user -.->|"calls binding"| node_c_api
node_user -.->|"calls binding"| node_python
node_user -.->|"calls binding"| node_rust
node_user -.->|"submits text"| node_wasm
node_text -.->|"parses"| node_parser
node_markdown -.->|"supports syntax"| node_parser
node_latex -.->|"supports syntax"| node_parser
node_qp_tags -.->|"supports tags"| node_parser
node_macros -.->|"expands macros"| node_parser
node_parser -.->|"produces AST"| node_ast
node_ast -.->|"optimizes"| node_optimizer
node_optimizer -.->|"renders"| node_common_html
node_optimizer -.->|"renders"| node_fixedadv_html
node_optimizer -.->|"renders"| node_plunity
node_common_html -.->|"produces"| node_html
node_fixedadv_html -.->|"produces"| node_html
node_console -.->|"converts text"| node_parser
node_c_api -->|"calls parser"| node_parser
node_python -.->|"converts text"| node_parser
node_rust -.->|"wraps C API"| node_c_api
node_wasm -.->|"converts text"| node_parser

click node_console "https://github.com/sekaiarendelle/pltxt2htm/blob/main/cmd/pltxt2htm.cc"
click node_c_api "https://github.com/sekaiarendelle/pltxt2htm/blob/main/c/src/pltxt2htm.cc"
click node_python "https://github.com/sekaiarendelle/pltxt2htm/blob/main/py/pltxt2htm.cc"
click node_rust "https://github.com/sekaiarendelle/pltxt2htm/blob/main/rust/pltxt2htm/src/lib.rs"
click node_wasm "https://github.com/sekaiarendelle/pltxt2htm/blob/main/wasm/pltxt2htm.cc"
click node_text "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_markdown "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_latex "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_qp_tags "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_macros "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_parser "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_ast "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_optimizer "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_common_html "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_fixedadv_html "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_plunity "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"
click node_html "https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_console,node_c_api,node_python,node_rust,node_wasm toneBlue
class node_text,node_markdown,node_latex,node_qp_tags,node_macros,node_parser,node_ast toneAmber
class node_optimizer,node_common_html,node_fixedadv_html,node_plunity,node_html toneMint
class node_user toneIndigo
```

## Components

### User interfaces

- [Console CLI](https://github.com/sekaiarendelle/pltxt2htm/blob/main/cmd/pltxt2htm.cc): `cmd/pltxt2htm.cc`
- [C API](https://github.com/sekaiarendelle/pltxt2htm/blob/main/c/src/pltxt2htm.cc): `c/src/pltxt2htm.cc`
- [Python binding](https://github.com/sekaiarendelle/pltxt2htm/blob/main/py/pltxt2htm.cc): `py/pltxt2htm.cc`
- [Rust binding](https://github.com/sekaiarendelle/pltxt2htm/blob/main/rust/pltxt2htm/src/lib.rs): `rust/pltxt2htm/src/lib.rs`
- [WebAssembly binding](https://github.com/sekaiarendelle/pltxt2htm/blob/main/wasm/pltxt2htm.cc): `wasm/pltxt2htm.cc`

### Parsing

- [Quantum text](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [Markdown syntax](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [LaTeX syntax](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [Physics tags](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [Context macros](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [Text parser](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [Parsed AST](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`

### Rendering

- [AST optimizer](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [Common HTML](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [Fixed-adv HTML](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [Unity text](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`
- [HTML output](https://github.com/sekaiarendelle/pltxt2htm/tree/main/include/pltxt2htm): `include/pltxt2htm`

### Other components

- **Text consumer**

## Connections

- Text consumer → Console CLI: submits text
- Text consumer → C API: calls binding
- Text consumer → Python binding: calls binding
- Text consumer → Rust binding: calls binding
- Text consumer → WebAssembly binding: submits text
- Quantum text → Text parser: parses
- Markdown syntax → Text parser: supports syntax
- LaTeX syntax → Text parser: supports syntax
- Physics tags → Text parser: supports tags
- Context macros → Text parser: expands macros
- Text parser → Parsed AST: produces AST
- Parsed AST → AST optimizer: optimizes
- AST optimizer → Common HTML: renders
- AST optimizer → Fixed-adv HTML: renders
- AST optimizer → Unity text: renders
- Common HTML → HTML output: produces
- Fixed-adv HTML → HTML output: produces
- Console CLI → Text parser: converts text
- C API → Text parser: calls parser (evidence: `c/src/pltxt2htm.cc`)
- Python binding → Text parser: converts text
- Rust binding → C API: wraps C API
- WebAssembly binding → Text parser: converts text
