# suryanshswarn09/git-doc architecture

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

- Interactive diagram: https://gitdiagram.com/suryanshswarn09/git-doc
- Repository: https://github.com/suryanshswarn09/git-doc

## Overview

Git-doc is a browser-based Markdown and LaTeX editor for live preview, document preparation, and PDF/HTML export, with GitHub integration for importing files and publishing drafts or commits. The user edits Markdown in the app, reviews its rendered preview, then exports or uses the GitHub panel to move content to a repository. The graph preserves documented GitHub and print capabilities; some detailed flows are documented in the README but their implementation was not fully sampled.

Main entry points: [`src/App.jsx`](https://github.com/suryanshswarn09/git-doc/blob/main/src/App.jsx) (Editor application), [`src/utils/githubApi.js`](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/githubApi.js) (GitHub API client), [`src/components/GitHubModal.jsx`](https://github.com/suryanshswarn09/git-doc/blob/main/src/components/GitHubModal.jsx) (GitHub panel), [`src/components/TemplateModal.jsx`](https://github.com/suryanshswarn09/git-doc/blob/main/src/components/TemplateModal.jsx) (Template picker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Editor and preview"]
  node_app["Editor application<br/>[App.jsx]"]
  node_renderer["Markdown renderer<br/>[App.jsx]"]
  node_templates["Document templates<br/>[templates.js]"]
  node_templateui["Template picker<br/>[TemplateModal.jsx]"]
  node_main["React entry point<br/>[main.jsx]"]
end

subgraph group_publishing["Document publishing"]
  node_printui["Print options<br/>[PrintModal.jsx]"]
  node_printconfig["Print layout config<br/>[printOptions.js]"]
  node_export["Export utilities<br/>[exportUtils.js]"]
end

subgraph group_github["GitHub integration"]
  node_githubui["GitHub panel<br/>[GitHubModal.jsx]"]
  node_githubapi["GitHub API client<br/>[githubApi.js]"]
  node_repo_tree["Repository browser<br/>[RepoFileTree.jsx]"]
  node_diff["Change review<br/>[DiffViewer.jsx]"]
end

subgraph group_support["Editor support"]
  node_highlight["Code highlighting<br/>[highlighter.js]"]
  node_math["Math sanitization<br/>[mathSanitizer.js]"]
  node_stats["Document statistics<br/>[documentStats.js]"]
  node_keys["Editor shortcuts"]
  node_toc["TOC generation<br/>[tocGenerator.js]"]
  node_scroll["Scroll sync<br/>[scrollSync.js]"]
  node_theme["Theme settings<br/>[themeUtils.js]"]
end

node_user(("Document author"))
node_github["GitHub REST API"]
node_browser[("Browser storage")]

node_user -->|"opens editor"| node_main
node_main -->|"renders"| node_app
node_app -->|"renders preview"| node_renderer
node_renderer -->|"highlights code"| node_highlight
node_app -->|"sanitizes math"| node_math
node_app -->|"computes stats"| node_stats
node_app -->|"handles shortcuts"| node_keys
node_app -->|"generates TOC"| node_toc
node_app -->|"stores preference"| node_scroll
node_app -->|"stores theme"| node_theme
node_app -->|"opens picker"| node_templateui
node_templateui -->|"loads templates"| node_templates
node_app -->|"opens settings"| node_printui
node_printui -->|"uses presets"| node_printconfig
node_app -->|"generates print CSS"| node_printconfig
node_app -->|"exports document"| node_export
node_app -->|"opens panel"| node_githubui
node_githubui -->|"requests GitHub actions"| node_githubapi
node_repo_tree -->|"fetches repository tree"| node_githubapi
node_githubui -->|"renders review"| node_diff
node_githubapi -->|"calls REST API"| node_github
node_githubapi -.->|"stores token"| node_browser
node_app -->|"stores preferences"| node_browser
node_github -.->|"returns API results"| node_githubapi
node_githubui -.->|"imports, saves, commits"| node_github

click node_app "https://github.com/suryanshswarn09/git-doc/blob/main/src/App.jsx"
click node_renderer "https://github.com/suryanshswarn09/git-doc/blob/main/src/App.jsx"
click node_highlight "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/highlighter.js"
click node_math "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/mathSanitizer.js"
click node_stats "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/documentStats.js"
click node_keys "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/editorKeyHandlers.js"
click node_toc "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/tocGenerator.js"
click node_scroll "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/scrollSync.js"
click node_theme "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/themeUtils.js"
click node_templates "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/templates.js"
click node_templateui "https://github.com/suryanshswarn09/git-doc/blob/main/src/components/TemplateModal.jsx"
click node_printui "https://github.com/suryanshswarn09/git-doc/blob/main/src/components/PrintModal.jsx"
click node_printconfig "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/printOptions.js"
click node_export "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/exportUtils.js"
click node_githubui "https://github.com/suryanshswarn09/git-doc/blob/main/src/components/GitHubModal.jsx"
click node_githubapi "https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/githubApi.js"
click node_repo_tree "https://github.com/suryanshswarn09/git-doc/blob/main/src/components/RepoFileTree.jsx"
click node_diff "https://github.com/suryanshswarn09/git-doc/blob/main/src/components/DiffViewer.jsx"
click node_main "https://github.com/suryanshswarn09/git-doc/blob/main/src/main.jsx"

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_app,node_renderer,node_templates,node_templateui,node_main toneBlue
class node_printui,node_printconfig,node_export,node_browser toneAmber
class node_githubui,node_githubapi,node_repo_tree,node_diff,node_github toneMint
class node_highlight,node_math,node_stats,node_keys,node_toc,node_scroll,node_theme toneRose
class node_user toneIndigo
```

## Components

### Editor and preview

- [Editor application](https://github.com/suryanshswarn09/git-doc/blob/main/src/App.jsx): `src/App.jsx`
- [Markdown renderer](https://github.com/suryanshswarn09/git-doc/blob/main/src/App.jsx): `src/App.jsx`
- [Document templates](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/templates.js): `src/utils/templates.js`
- [Template picker](https://github.com/suryanshswarn09/git-doc/blob/main/src/components/TemplateModal.jsx): `src/components/TemplateModal.jsx`
- [React entry point](https://github.com/suryanshswarn09/git-doc/blob/main/src/main.jsx): `src/main.jsx`

### Document publishing

- [Print options](https://github.com/suryanshswarn09/git-doc/blob/main/src/components/PrintModal.jsx): `src/components/PrintModal.jsx`
- [Print layout config](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/printOptions.js): `src/utils/printOptions.js`
- [Export utilities](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/exportUtils.js): `src/utils/exportUtils.js`

### GitHub integration

- [GitHub panel](https://github.com/suryanshswarn09/git-doc/blob/main/src/components/GitHubModal.jsx): `src/components/GitHubModal.jsx`
- [GitHub API client](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/githubApi.js): `src/utils/githubApi.js`
- [Repository browser](https://github.com/suryanshswarn09/git-doc/blob/main/src/components/RepoFileTree.jsx): `src/components/RepoFileTree.jsx`
- [Change review](https://github.com/suryanshswarn09/git-doc/blob/main/src/components/DiffViewer.jsx): `src/components/DiffViewer.jsx`

### Editor support

- [Code highlighting](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/highlighter.js): `src/utils/highlighter.js`
- [Math sanitization](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/mathSanitizer.js): `src/utils/mathSanitizer.js`
- [Document statistics](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/documentStats.js): `src/utils/documentStats.js`
- [Editor shortcuts](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/editorKeyHandlers.js): `src/utils/editorKeyHandlers.js`
- [TOC generation](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/tocGenerator.js): `src/utils/tocGenerator.js`
- [Scroll sync](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/scrollSync.js): `src/utils/scrollSync.js`
- [Theme settings](https://github.com/suryanshswarn09/git-doc/blob/main/src/utils/themeUtils.js): `src/utils/themeUtils.js`

### Other components

- **Document author**
- **GitHub REST API**
- **Browser storage**

## Connections

- Document author → React entry point: opens editor (evidence: `src/main.jsx`)
- React entry point → Editor application: renders (evidence: `src/main.jsx`)
- Editor application → Markdown renderer: renders preview (evidence: `src/App.jsx`)
- Markdown renderer → Code highlighting: highlights code (evidence: `src/App.jsx`)
- Editor application → Math sanitization: sanitizes math (evidence: `src/App.jsx`)
- Editor application → Document statistics: computes stats (evidence: `src/App.jsx`)
- Editor application → Editor shortcuts: handles shortcuts (evidence: `src/App.jsx`)
- Editor application → TOC generation: generates TOC (evidence: `src/App.jsx`)
- Editor application → Scroll sync: stores preference (evidence: `src/App.jsx`)
- Editor application → Theme settings: stores theme (evidence: `src/App.jsx`)
- Editor application → Template picker: opens picker (evidence: `src/App.jsx`)
- Template picker → Document templates: loads templates (evidence: `src/components/TemplateModal.jsx`)
- Editor application → Print options: opens settings (evidence: `src/App.jsx`)
- Print options → Print layout config: uses presets (evidence: `src/components/PrintModal.jsx`)
- Editor application → Print layout config: generates print CSS (evidence: `src/App.jsx`)
- Editor application → Export utilities: exports document (evidence: `src/App.jsx`)
- Editor application → GitHub panel: opens panel (evidence: `src/App.jsx`)
- GitHub panel → GitHub API client: requests GitHub actions (evidence: `src/components/GitHubModal.jsx`)
- Repository browser → GitHub API client: fetches repository tree (evidence: `src/components/RepoFileTree.jsx`)
- GitHub panel → Change review: renders review (evidence: `src/components/GitHubModal.jsx`)
- GitHub API client → GitHub REST API: calls REST API (evidence: `src/utils/githubApi.js`)
- GitHub API client → Browser storage: stores token (evidence: `README.md`)
- Editor application → Browser storage: stores preferences (evidence: `src/App.jsx`)
- GitHub REST API → GitHub API client: returns API results (evidence: `README.md`)
- GitHub panel → GitHub REST API: imports, saves, commits (evidence: `README.md`)
