# kalen5241/markdownpreviewer architecture

> Architecture diagram of the GitHub repository kalen5241/markdownpreviewer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kalen5241/markdownpreviewer
- Repository: https://github.com/kalen5241/markdownpreviewer

## Overview

##### File structure
Top-level directories and files:
- src/ – the Vue application source
– main.js: application entry point
– App.vue: root component
– views/: individual screens (Form.vue, StringSplitter.vue, etc.)
– js/katex-parser.js: custom math parser
– locales/: JSON files for en, ja, zh + i18n setup
– assets/main.css: global styles
- public/ – static assets copied verbatim to the build
- lark-help/ – Markdown help content under help-md/ and TypeScript definitions under help-ts/
- dist/ – Vite’s build output (index.html + compiled JS/CSS assets)
- vite.config.js, tsconfig*.json, package.json – build and tooling configuration

##### README
- Confirms the project name (“MarkdownPreviewer”) and purpose (“Markdown 预览器” i.e., “Markdown previewer”). No extra architecture notes.

##### Elements
- Clear labels for:
– Developer Machine & Build System
– Static Hosting / CDN
– Browser (Application Runtime)
– Source code → build → dist/ → hosting → browser
– User input → Vue components → parser modules → rendered output

##### Final advice
- The goal is to reflect precisely what lives in src/, what gets bundled, where it’s hosted, and how it flows at runtime in the browser.

## Diagram (Mermaid)

```mermaid
flowchart TB
  %% Developer & Build System
  subgraph "Developer Machine & Build System"
    direction TB
    NPM["package.json"]:::build
    NPMLOCK["package-lock.json"]:::build
    VITE["vite.config.js"]:::build
    TSCONFIG1["tsconfig.json"]:::build
    TSCONFIG2["tsconfig.node.json"]:::build
    PUBLIC["public/"]:::build
  end

  NPM -->|deps & scripts| VITE
  NPM -->|ts setup| TSCONFIG1
  NPM -->|ts node| TSCONFIG2
  VITE -->|serves static| PUBLIC

  %% Build Output
  subgraph "Build Output"
    direction TB
    DIST["dist/"]:::hosting
    INDEXDIST["dist/index.html"]:::hosting
    ASSETS_DIST["dist/assets/"]:::hosting
  end
  VITE -->|build→| DIST
  DIST --> INDEXDIST
  DIST --> ASSETS_DIST

  %% Static Hosting
  subgraph "Static Hosting / CDN"
    direction TB
    HOST["CDN / Web Server"]:::hosting
  end
  DIST -->|deploy| HOST

  %% Client Runtime
  subgraph "Client (Browser)" 
    direction TB
    LOAD["index.html"]:::client
    MAINJS["src/main.js"]:::client
    APPVUE["src/App.vue"]:::client
    subgraph "Vue Views"
      direction TB
      FORM["src/views/Form.vue"]:::client
      SSPLITTER["src/views/StringSplitter.vue"]:::client
      SSPLITSUB["src/views/StringSplitterSub.vue"]:::client
    end
    STYLE["src/assets/main.css"]:::client
    subgraph "Parsing Modules"
      direction TB
      MDPARSER["Markdown Parser"]:::lib
      KATEX["src/js/katex-parser.js"]:::lib
      MERMAID["mermaid-parser.core.*.js"]:::lib
      DAGRE["dagre-*.js"]:::lib
      CYTO["cytoscape.esm.*.js"]:::lib
    end
    subgraph "i18n"
      direction TB
      I18NJS["src/locales/i18n.js"]:::client
      EN["src/locales/en.json"]:::client
      JA["src/locales/ja.json"]:::client
      ZH["src/locales/zh.json"]:::client
    end
    HELPLOADER["Help Content Loader"]:::client
    HELPMD["lark-help/help-md/"]:::client
    HELPTS["lark-help/help-ts/index.d.ts"]:::client
  end

  HOST -->|serves| LOAD
  LOAD --> MAINJS
  MAINJS --> APPVUE
  APPVUE --> FORM
  APPVUE --> SSPLITTER
  APPVUE --> SSPLITSUB
  APPVUE --> STYLE
  APPVUE --> MDPARSER
  MDPARSER --> KATEX
  MDPARSER --> MERMAID
  MDPARSER --> DAGRE
  MDPARSER --> CYTO
  APPVUE --> I18NJS
  I18NJS --> EN
  I18NJS --> JA
  I18NJS --> ZH
  APPVUE --> HELPLOADER
  HELPLOADER --> HELPMD
  HELPLOADER --> HELPTS

  %% Click Events
  click NPM "https://github.com/kalen5241/markdownpreviewer/blob/main/package.json"
  click NPMLOCK "https://github.com/kalen5241/markdownpreviewer/blob/main/package-lock.json"
  click VITE "https://github.com/kalen5241/markdownpreviewer/blob/main/vite.config.js"
  click TSCONFIG1 "https://github.com/kalen5241/markdownpreviewer/blob/main/tsconfig.json"
  click TSCONFIG2 "https://github.com/kalen5241/markdownpreviewer/blob/main/tsconfig.node.json"
  click PUBLIC "https://github.com/kalen5241/markdownpreviewer/tree/main/public/"
  click DIST "https://github.com/kalen5241/markdownpreviewer/tree/main/dist/"
  click INDEXDIST "https://github.com/kalen5241/markdownpreviewer/blob/main/dist/index.html"
  click ASSETS_DIST "https://github.com/kalen5241/markdownpreviewer/tree/main/dist/assets/"
  click LOAD "https://github.com/kalen5241/markdownpreviewer/blob/main/index.html"
  click MAINJS "https://github.com/kalen5241/markdownpreviewer/blob/main/src/main.js"
  click APPVUE "https://github.com/kalen5241/markdownpreviewer/blob/main/src/App.vue"
  click FORM "https://github.com/kalen5241/markdownpreviewer/blob/main/src/views/Form.vue"
  click SSPLITTER "https://github.com/kalen5241/markdownpreviewer/blob/main/src/views/StringSplitter.vue"
  click SSPLITSUB "https://github.com/kalen5241/markdownpreviewer/blob/main/src/views/StringSplitterSub.vue"
  click STYLE "https://github.com/kalen5241/markdownpreviewer/blob/main/src/assets/main.css"
  click KATEX "https://github.com/kalen5241/markdownpreviewer/blob/main/src/js/katex-parser.js"
  click I18NJS "https://github.com/kalen5241/markdownpreviewer/blob/main/src/locales/i18n.js"
  click EN "https://github.com/kalen5241/markdownpreviewer/blob/main/src/locales/en.json"
  click JA "https://github.com/kalen5241/markdownpreviewer/blob/main/src/locales/ja.json"
  click ZH "https://github.com/kalen5241/markdownpreviewer/blob/main/src/locales/zh.json"
  click HELPMD "https://github.com/kalen5241/markdownpreviewer/tree/main/lark-help/help-md/"
  click HELPTS "https://github.com/kalen5241/markdownpreviewer/blob/main/lark-help/help-ts/index.d.ts"

  %% Styles
  classDef build fill:#DDD,stroke:#333,stroke-width:1px
  classDef hosting fill:#DFD,stroke:#333,stroke-width:1px
  classDef client fill:#BBE,stroke:#333,stroke-width:1px
  classDef lib fill:#FED,stroke:#333,stroke-width:1px
```
