# svonjoi/obsidian-heading-level-indent architecture

> Architecture diagram of the GitHub repository svonjoi/obsidian-heading-level-indent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/svonjoi/obsidian-heading-level-indent
- Repository: https://github.com/svonjoi/obsidian-heading-level-indent

## Overview

1. **Project type and runtime**
   - This is an **Obsidian community plugin** written in **TypeScript**.
   - It runs inside the Obsidian desktop app and augments note rendering/editing rather than serving a standalone UI.

2. **Core purpose**
   - The plugin adds **visual indentation to content under Markdown headings** so document hierarchy is easier to scan.
   - Indentation is based on heading level and can be customized through plugin settings.

3. **Primary entrypoint**
   - `src/main.ts` is the plugin bootstrap and central coordinator.
   - It is responsible for loading settings, registering listeners/hooks, and wiring the plugin’s editing and reading-view behavior into Obsidian.

4. **Runtime subsystems**
   - `src/editingMode.ts` handles behavior in the editor / live preview context.
   - `src/renderedMode.ts` handles behavior in rendered/reading view.
   - These are the two main execution paths, reflecting Obsidian’s split between editable Markdown and rendered Markdown.

5. **Per-document control**
   - `src/FrontmatterListener.ts` adds note-level enable/disable logic using frontmatter.
   - The `heading-indent` frontmatter key acts as a document boundary:
     - omitted or `true` → indentation enabled
     - `false` → indentation disabled
   - This means the plugin can be active globally but selectively suppressed per note.

6. **Configuration boundary**
   - `src/settings.ts` holds the plugin’s user-configurable options, including indentation customization.
   - Settings likely influence the indentation amount or behavior per heading level and are shared by both editing and rendered modes.

7. **Data flow at runtime**
   - A note is opened or updated.
   - Frontmatter is inspected to decide whether heading indentation should apply.
   - The active mode determines whether `editingMode` or `renderedMode` applies the visual treatment.
   - The plugin then adjusts the displayed structure without changing the underlying note content.

8. **Rendering strategy**
   - The plugin is visually invasive rather than content-transforming: it changes **presentation** of blocks under headings.
   - The readme indicates support across code blocks, blockquotes, callouts, tables, LaTeX blocks, embeds, and canvas-related content, so the indentation logic likely needs to account for multiple rendered block types.

9. **Packaging and build tooling**
   - `esbuild.config.mjs` is the build bundler configuration for producing the plugin artifact.
   - `manifest.json` defines the Obsidian plugin metadata used by the app and community marketplace.
   - `versions.json` and `version-bump.mjs` indicate release/version management for distributing plugin updates.

10. **Quality and repo tooling**
   - `eslint.config.js`, `biome.json`, and `tsconfig.json` show the repo uses standard TypeScript linting/formatting/type-checking.
   - These tools support development, but they do not affect the runtime architecture.

11. **Important architectural boundary**
   - The plugin does not appear to introduce a server, database, or external API dependency.
   - The key boundary is between **note metadata + Obsidian view state** on one side and **visual indentation behavior** on the other.

12. **How to diagram it**
   - Model the system as:
     - Obsidian host app
     - Plugin entrypoint
     - Settings/frontmatter decision layer
     - Two view-specific applicators: editing and rendered mode
     - Build/release tooling as a separate offline pipeline
   - The main runtime arrows are from **note content + frontmatter + settings** into **mode-specific indentation rendering**.

Main entry points: [`src/main.ts`](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/main.ts) (Plugin entry), [`src/renderedMode.ts`](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/renderedMode.ts) (Rendered mode), [`src/editingMode.ts`](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/editingMode.ts) (Editing mode), [`src/FrontmatterListener.ts`](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/FrontmatterListener.ts) (Frontmatter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_obsidian["Obsidian<br/>host app"]
  node_main["Plugin entry<br/>bootstrap<br/>[main.ts]"]
  node_settings["Settings<br/>config model<br/>[settings.ts]"]
  node_frontmatter["Frontmatter<br/>note gate"]
  node_editing["Editing mode<br/>editor path<br/>[editingMode.ts]"]
  node_rendered["Rendered mode<br/>reader path<br/>[renderedMode.ts]"]
  node_headingview["Indented view<br/>visual effect"]
  node_content["Note content<br/>markdown input"]
  node_blocktypes["Block types<br/>render targets"]
end

subgraph group_tooling["Tooling"]
  node_esbuild["esbuild config<br/>bundle config<br/>[esbuild.config.mjs]"]
  node_manifest["Manifest<br/>plugin metadata<br/>[manifest.json]"]
  node_versions["Versions<br/>release map<br/>[versions.json]"]
  node_bump["Version bump<br/>release script<br/>[version-bump.mjs]"]
  node_typescript["TypeScript<br/>typecheck config<br/>[tsconfig.json]"]
  node_eslint["ESLint<br/>lint config<br/>[eslint.config.js]"]
  node_biome["Biome<br/>format config<br/>[biome.json]"]
end

node_obsidian -->|"loads"| node_main
node_main -->|"initializes"| node_settings
node_main -->|"registers"| node_frontmatter
node_main -->|"wires"| node_editing
node_main -->|"wires"| node_rendered
node_frontmatter -->|"permits"| node_editing
node_frontmatter -->|"permits"| node_rendered
node_settings -->|"configures"| node_editing
node_settings -->|"configures"| node_rendered
node_content -->|"checks"| node_frontmatter
node_content -->|"flows into"| node_editing
node_content -->|"flows into"| node_rendered
node_blocktypes -->|"special-cases"| node_rendered
node_editing -->|"applies"| node_headingview
node_rendered -->|"applies"| node_headingview
node_esbuild -.->|"bundles"| node_main
node_manifest -.->|"declares"| node_obsidian
node_versions -.->|"drives"| node_bump
node_typescript -.->|"checks"| node_main
node_eslint -.->|"checks"| node_main
node_biome -.->|"checks"| node_main

click node_main "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/main.ts"
click node_settings "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/settings.ts"
click node_frontmatter "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/FrontmatterListener.ts"
click node_editing "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/editingMode.ts"
click node_rendered "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/renderedMode.ts"
click node_esbuild "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/esbuild.config.mjs"
click node_manifest "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/manifest.json"
click node_versions "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/versions.json"
click node_bump "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/version-bump.mjs"
click node_typescript "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/tsconfig.json"
click node_eslint "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/eslint.config.js"
click node_biome "https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/biome.json"

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_obsidian,node_main,node_settings,node_frontmatter,node_editing,node_rendered,node_headingview,node_content,node_blocktypes toneBlue
class node_esbuild,node_manifest,node_versions,node_bump,node_typescript,node_eslint,node_biome toneAmber
```

## Components

### Runtime

Plugin execution inside Obsidian

- **Obsidian**: host app · Desktop note editor and renderer that loads the plugin
- [Plugin entry](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/main.ts): bootstrap · Central coordinator for activation and hook registration · `src/main.ts`
- [Settings](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/settings.ts): config model · User options that control indentation behavior · `src/settings.ts`
- [Frontmatter](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/FrontmatterListener.ts): note gate · Per-note enable or disable switch based on heading-indent metadata · `src/FrontmatterListener.ts`
- [Editing mode](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/editingMode.ts): editor path · Applies indentation in live preview and editor context · `src/editingMode.ts`
- [Rendered mode](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/src/renderedMode.ts): reader path · Applies indentation in reading view and rendered content · `src/renderedMode.ts`
- **Indented view**: visual effect · Presentation layer that visually shifts content under headings
- **Note content**: markdown input · Headings and nested blocks being displayed
- **Block types**: render targets · Code blocks, callouts, tables, embeds, quotes, and similar rendered content

### Tooling

Build and release pipeline

- [esbuild config](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/esbuild.config.mjs): bundle config · Build configuration for the plugin artifact · `esbuild.config.mjs`
- [Manifest](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/manifest.json): plugin metadata · Obsidian plugin metadata and marketplace identity · `manifest.json`
- [Versions](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/versions.json): release map · Version compatibility and release tracking · `versions.json`
- [Version bump](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/version-bump.mjs): release script · Automates release version updates · `version-bump.mjs`
- [TypeScript](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/tsconfig.json): typecheck config · Compiler and module settings for the source code · `tsconfig.json`
- [ESLint](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/eslint.config.js): lint config · JavaScript and TypeScript linting rules · `eslint.config.js`
- [Biome](https://github.com/svonjoi/obsidian-heading-level-indent/blob/master/biome.json): format config · Formatting and code quality rules · `biome.json`

## Connections

- Obsidian → Plugin entry: loads · Obsidian activates the plugin entrypoint
- Plugin entry → Settings: initializes · Loads shared configuration at startup
- Plugin entry → Frontmatter: registers · Installs note-level enable/disable listener
- Plugin entry → Editing mode: wires · Connects editor and live preview behavior
- Plugin entry → Rendered mode: wires · Connects reading view behavior
- Frontmatter → Editing mode: permits · Allows editing-mode indentation when enabled
- Frontmatter → Rendered mode: permits · Allows rendered-mode indentation when enabled
- Settings → Editing mode: configures · Provides indentation options to editor path
- Settings → Rendered mode: configures · Provides indentation options to reader path
- Note content → Frontmatter: checks · Note metadata determines whether the plugin applies
- Note content → Editing mode: flows into · Editable markdown is processed in the editor path
- Note content → Rendered mode: flows into · Rendered markdown is processed in the reader path
- Block types → Rendered mode: special-cases · Rendered block structures need tailored indentation handling
- Editing mode → Indented view: applies · Transforms live editor presentation
- Rendered mode → Indented view: applies · Transforms reading-view presentation
- esbuild config → Plugin entry: bundles · Builds the plugin source into distributable output
- Manifest → Obsidian: declares · Describes plugin identity to Obsidian
- Versions → Version bump: drives · Version data used during release updates
- TypeScript → Plugin entry: checks · Type checking applies to the source tree
- ESLint → Plugin entry: checks · Linting applies to the source tree
- Biome → Plugin entry: checks · Formatting and code quality apply to the source tree
