# s-abhilash/source_code_to_html_converter architecture

> Architecture diagram of the GitHub repository s-abhilash/source_code_to_html_converter, 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/s-abhilash/source_code_to_html_converter
- Repository: https://github.com/s-abhilash/source_code_to_html_converter

## Overview

source_to_html is a command-line C source-to-HTML highlighter. The user supplies a source filename; the CLI opens it, repeatedly requests parser events, renders each non-null/non-EOF event, closes the HTML document, and launches Firefox on the generated file. The parser classifies source text into event types, and the renderer maps those types to HTML spans. HTML links styles.css for presentation. The excerpts show this main flow; no README detail or sampled CSS establishes additional capabilities.

Main entry points: [`s2h_main.c`](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_main.c) (Conversion CLI), [`s2h_conv.c`](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_conv.c) (HTML document framing), [`s2h_event.c`](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_event.c) (Event parser), [`s2h_event.h`](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_event.h) (Parser event model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Conversion workflow"]
  node_cli["Conversion CLI<br/>[s2h_main.c]"]
end

subgraph group_parser["Parsing"]
  node_parser["Event parser<br/>[s2h_event.c]"]
  node_event["Parser event model<br/>[s2h_event.h]"]
end

subgraph group_output["HTML output"]
  node_renderer["Syntax renderer<br/>[s2h_conv.c]"]
  node_htmlframe["HTML document framing<br/>[s2h_conv.c]"]
  node_stylesheet["HTML stylesheet<br/>[styles.css]"]
  node_htmlfile["Generated HTML"]
end

node_user(("Source file user"))
node_browser(("Firefox browser"))

node_user -->|"provides filename"| node_cli
node_cli -->|"requests events"| node_parser
node_parser -->|"returns events"| node_event
node_cli -->|"renders events"| node_renderer
node_cli -->|"opens and closes"| node_htmlframe
node_htmlframe -->|"links stylesheet"| node_stylesheet
node_renderer -->|"writes markup"| node_htmlfile
node_htmlframe -->|"writes framing"| node_htmlfile
node_cli -->|"launches Firefox"| node_browser
node_cli -->|"generates file"| node_htmlfile

click node_cli "https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_main.c"
click node_parser "https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_event.c"
click node_event "https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_event.h"
click node_renderer "https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_conv.c"
click node_htmlframe "https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_conv.c"
click node_stylesheet "https://github.com/s-abhilash/source_code_to_html_converter/blob/master/styles.css"

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_cli,node_user,node_browser toneBlue
class node_parser,node_event toneAmber
class node_renderer,node_htmlframe,node_stylesheet,node_htmlfile toneMint
```

## Components

### Conversion workflow

- [Conversion CLI](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_main.c): `s2h_main.c`

### Parsing

- [Event parser](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_event.c): `s2h_event.c`
- [Parser event model](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_event.h): `s2h_event.h`

### HTML output

- [Syntax renderer](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_conv.c): `s2h_conv.c`
- [HTML document framing](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/s2h_conv.c): `s2h_conv.c`
- [HTML stylesheet](https://github.com/s-abhilash/source_code_to_html_converter/blob/master/styles.css): `styles.css`
- **Generated HTML**

### Other components

- **Source file user**
- **Firefox browser**

## Connections

- Source file user → Conversion CLI: provides filename (evidence: `s2h_main.c`)
- Conversion CLI → Event parser: requests events (evidence: `s2h_main.c`)
- Event parser → Parser event model: returns events (evidence: `s2h_event.c`)
- Conversion CLI → Syntax renderer: renders events (evidence: `s2h_main.c`)
- Conversion CLI → HTML document framing: opens and closes (evidence: `s2h_main.c`)
- HTML document framing → HTML stylesheet: links stylesheet (evidence: `s2h_conv.c`)
- Syntax renderer → Generated HTML: writes markup (evidence: `s2h_conv.c`)
- HTML document framing → Generated HTML: writes framing (evidence: `s2h_conv.c`)
- Conversion CLI → Firefox browser: launches Firefox (evidence: `s2h_main.c`)
- Conversion CLI → Generated HTML: generates file (evidence: `s2h_main.c`)
