# wilson27-11/source-to-html architecture

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

- Interactive diagram: https://gitdiagram.com/wilson27-11/source-to-html
- Repository: https://github.com/wilson27-11/source-to-html

## Overview

Source-to-html is a small command-line C-to-HTML converter. Its workflow is: accept an input path, read the C source, tokenize and classify it, then write a line-numbered, syntax-colored HTML document. The tokenizer and HTML emission are implemented together in one source file. Relationships shown are directly supported by that file; the README documents the converter’s overall purpose and dark theme.

Main entry points: [`src2html.c`](https://github.com/wilson27-11/source-to-html/blob/main/src2html.c) (CLI orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("CLI user"))
node_main["CLI orchestration<br/>[src2html.c]"]
node_reader["Source reader<br/>[src2html.c]"]
node_highlighter["C highlighter<br/>[src2html.c]"]
node_html["HTML emitter<br/>[src2html.c]"]
node_source["C source file"]
node_result["HTML document"]

node_user -->|"provides arguments"| node_main
node_source -->|"reads bytes"| node_reader
node_main -->|"calls"| node_reader
node_reader -->|"returns buffer"| node_main
node_main -->|"passes source"| node_highlighter
node_highlighter -->|"emits tokens"| node_html
node_main -->|"writes page"| node_html
node_html -->|"writes document"| node_result

click node_main "https://github.com/wilson27-11/source-to-html/blob/main/src2html.c"
click node_reader "https://github.com/wilson27-11/source-to-html/blob/main/src2html.c"
click node_highlighter "https://github.com/wilson27-11/source-to-html/blob/main/src2html.c"
click node_html "https://github.com/wilson27-11/source-to-html/blob/main/src2html.c"

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_user toneBlue
class node_main,node_reader,node_highlighter,node_html toneTeal
class node_source,node_result toneIndigo
```

## Components

### Other components

- **CLI user**
- [CLI orchestration](https://github.com/wilson27-11/source-to-html/blob/main/src2html.c): `src2html.c`
- [Source reader](https://github.com/wilson27-11/source-to-html/blob/main/src2html.c): `src2html.c`
- [C highlighter](https://github.com/wilson27-11/source-to-html/blob/main/src2html.c): `src2html.c`
- [HTML emitter](https://github.com/wilson27-11/source-to-html/blob/main/src2html.c): `src2html.c`
- **C source file**
- **HTML document**

## Connections

- CLI user → CLI orchestration: provides arguments (evidence: `src2html.c`)
- C source file → Source reader: reads bytes (evidence: `src2html.c`)
- CLI orchestration → Source reader: calls (evidence: `src2html.c`)
- Source reader → CLI orchestration: returns buffer (evidence: `src2html.c`)
- CLI orchestration → C highlighter: passes source (evidence: `src2html.c`)
- C highlighter → HTML emitter: emits tokens (evidence: `src2html.c`)
- CLI orchestration → HTML emitter: writes page (evidence: `src2html.c`)
- HTML emitter → HTML document: writes document (evidence: `src2html.c`)
