Yinlong Zhao1 downloadsDraw and edit digital logic circuits directly inside Markdown notes.
Draw digital logic circuits directly inside Markdown notes in Obsidian. The desktop plugin stores each circuit in a logic-circuit fenced block, with no separate diagram files, network requests, or simulation.
See DESIGN.md for the design and examples/Logic circuits.md for sample diagrams.
npm install, then npm run package with Node.js 22 or newer.main.js, manifest.json, and styles.css from dist/logic-circuits/ into <Vault>/.obsidian/plugins/logic-circuits/.This checkout is already in a test vault's plugin folder. Running npm run build places installable files directly at its root. Reload the plugin to load a new build. Generated main.js and dist/ are excluded from version control.
The permanent plugin ID is logic-circuits; the installed folder must use that name. Obsidian 1.8.0 or newer is required. The first release supports desktop only.
Each block fills the note's content width and displays its entire circuit. In Live Preview, hover over the block to reveal −, +, Fit, and Edit; keyboard focus also makes these controls available. Type a zoom percentage between − and +, then press Enter or leave the field to apply it. Esc cancels. Values from 25% to 300% are accepted, with enlargement capped to the available width. Scale changes do not rewrite object positions. Narrower panes temporarily reduce the displayed scale; each circuit keeps its saved preference.
Controls use short, delayed native tooltips. The immediate black tooltip bubbles are removed while accessible control names remain available to assistive technology.
− and + move in 10-point percentage steps (89.2% becomes 80% or 90%). + stops when the next whole step would exceed the width; Fit uses the exact scale that fits, which may include a decimal.
Set the initial scale for new blocks in Settings → Logic circuits → Default circuit scale. Existing circuits retain their own scales.
Reading view displays the saved circuit without editing controls, circuit menus, or selection effects. Switch to Live Preview to edit a diagram or move/delete its block. In Source mode, edit the fenced JSON as normal Markdown. Ordinary scrolling moves through the note, and note keyboard shortcuts remain available outside the diagram.
The plugin locates and validates the intended block again before every update. Changes to surrounding Markdown and other circuits are preserved. Copied blocks receive independent IDs when their selected occurrence can be identified safely.
If the same block changed elsewhere, or a write fails, automatic saving stops and the local draft remains available. Select Reload from note to explicitly discard the draft, or Copy draft to recover it without overwriting the note. If its original widget is gone, run Logic circuits: Recover unsaved circuit drafts.
The two entries in Settings → Hotkeys are separate commands: insertion and draft recovery. Recovery has no default shortcut.
Recovery drafts are held in memory while the plugin is loaded. Copy an unresolved draft before disabling the plugin or quitting Obsidian. Session undo history is not persisted across reopenings.
Malformed JSON and unsupported schemas produce an inline error without modifying their original content. Correct them in Source mode.
Temporary editing errors disappear after four seconds. Malformed-data errors and saving conflicts remain visible with their recovery instructions.
npm install
npm run dev
npm run build
npm test
npm run lint
npm run test:ui
npm run package
npm test exercises connection rules, junction edits, history, guarded Markdown updates, block operations, and save-session conflicts. Browser tests exercise the diagram and the real CodeMirror Live Preview extension; native Obsidian mode checks complement those tests. Browser tests use a locally installed Chromium (set PLAYWRIGHT_CHROMIUM_PATH if needed), and write artifacts to a temporary directory.
Sources are separated into src/model/, src/storage/, src/ui/, and src/integration/. React and React Flow are bundled into main.js; Obsidian supplies the external CodeMirror runtime. The build combines React Flow's base stylesheet and src/ui/styles.css into shipped styles.css.
The build removes React DOM's unused script loaders and script-rendering paths, rejects dynamic script tags and raw HTML, and checks the emitted bundle for script creation. scripts/no-runtime-scripts.mjs verifies the audited React DOM source before transforming it; dependency upgrades require reviewing these paths and updating the audited hashes. Development and production builds use the same restrictions, covered by npm run test:ui -- runtime-scripts.
No network access, telemetry, or external services. The plugin reads and updates only relevant notes inside the vault and stores the default scale in its normal plugin settings.
MIT, copyright 2026 Yinlong Zhao. See LICENSE.
The original Obsidian sample-plugin notice is retained in licenses/obsidian-sample-plugin-0BSD.txt. Bundled dependencies retain their own licenses. Every build generates THIRD-PARTY-NOTICES.txt from the packages actually included and embeds the complete notices in main.js, so normal Obsidian installation includes them automatically. Packaged downloads also include the separate license files.