Mermaid Integrator
approvedby fangface-hub
Obsidian plugin to assist editing Mermaid code blocks - This plugin has not been manually reviewed by Obsidian staff.
Obsidian Mermaid Integrator
An Obsidian plugin base that helps users edit Mermaid code blocks quickly.
Features (current base)
- Wrap current selection with a
mermaidcode block. - Insert a Mermaid flowchart template.
- Configure default flow direction (
TDorLR). - Parse
%% @metain Mermaid code blocks and apply styles to rendered diagrams.
Mermaid metadata
You can embed style metadata in Mermaid line comments using %% @meta.
%% @meta data-align:center; data-width:80%; data-margin:0 auto;
flowchart TD
A[Start] --> B[End]
Syntax rules:
- Start the metadata line with
%% @meta. - Write
key:value;pairs. - Separate declarations with
;. - Put metadata before Mermaid DSL lines.
Supported metadata:
| Metadata | Meaning | Example |
|---|---|---|
data-align | Horizontal alignment override for SVG placement. | left, center, right |
data-width | SVG width inside the container. When specified, responsive max-width: 100% is disabled for that diagram. | 80%, 600px, original |
data-margin | Outer margin for the diagram container. | 12px, 0 auto |
data-background | Background color for the diagram container. | #fff |
data-zoom | Diagram zoom scale. | 1.2 |
data-interactive | Adds data-interactive attribute to the rendered container. | true |
data-theme | Adds data-theme attribute to the rendered container. | dark |
Notes:
data-width:originalkeeps Mermaid's original width behavior.data-themeanddata-interactiveare exposed as HTMLdata-*attributes.
Build
- Install dependencies:
npm install
- Build:
npm run build
npm run build creates a release artifact with debug logging suppressed.
To build with debug logging enabled:
npm run build:debug
Development
Watch mode:
npm run dev
npm run dev keeps debug logging enabled for diagnostics while developing.
Copy manifest.json and main.js to your Obsidian vault plugin folder.
If present, copy styles.css as well.
Lint
Run lint checks:
npm run lint
Run lint checks with auto-fix:
npm run lint:fix
npm run lint:fix only applies ESLint auto-fixes and does not update version files.
Community Plugin Release
-
Verify
manifest.jsonfields:id,name,author,description, andversion. -
Run
npm run lint:fix. -
Run
npm run lintto verify the plugin meets Obsidian guidelines. -
Bump the version based on the type of release:
- For bug fixes (patch):
npm run version:patch - For new features (minor):
npm run version:minor - For breaking changes (major):
npm run version:major
This updates
package.json,manifest.json, andversions.jsontogether. - For bug fixes (patch):
-
Run
npm run buildto generatemain.js. -
Create a GitHub Release with the same tag as the
manifest.jsonversion. -
Attach the following 3 files as release assets:
manifest.jsonmain.jsstyles.css(optional, when the file exists)
Version Management
This project follows Semantic Versioning (MAJOR.MINOR.PATCH).
Version Bump Commands
- Major version bump (breaking changes):
npm run version:major
- Minor version bump (new features):
npm run version:minor
- Patch version bump (bug fixes):
npm run version:patch
What the version commands do
Each version bump command automatically updates:
package.json- Package versionmanifest.json- Plugin manifest versionversions.json- Version history with minimum Obsidian version
GitHub Actions (Release ZIP)
- Workflow file:
.github/workflows/release-zip.yml - Trigger (manual):
workflow_dispatch - Output ZIP:
${id}-${version}.zipcontainingmanifest.json,main.js,versions.json, andstyles.csswhen present - Output destination: uploaded as a workflow artifact
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.