An Obsidian.md plugin to embed CircuitJS circuit simulations directly into your notes.

This plugin bridges the gap between circuit design and documentation. CircuitJS is an excellent tool for sketching out circuit designs, and this plugin allows you to:
<vault>/.obsidian/plugins/circuitjs/File → Export As Text...circuitjs tag:```circuitjs
$ 1 0.000005 10.20027730826997 50 5 43 5e-11
r 176 80 384 80 0 10
s 384 80 448 80 0 1 false
w 176 80 176 352 0
c 384 352 176 352 0 0.000015 -9.16123055990675 -10
l 384 80 384 352 0 1 -0.01424104005209455 0
v 448 352 448 80 0 0 40 5 0 0 0.5
r 384 352 448 352 0 100
o 4 64 0 4099 20 0.05 0 2 4 3
o 3 64 0 4099 20 0.05 1 2 3 3
o 0 64 0 4099 0.625 0.05 2 2 0 3
38 3 F1 0 0.000001 0.000101 -1 Capacitance
38 4 F1 0 0.01 1.01 -1 Inductance
38 0 F1 0 1 101 -1 Resistance
h 1 4 3
```
The circuit text format uses single-letter codes for components:
| Code | Component |
|---|---|
$ |
Header/settings line |
r |
Resistor |
c |
Capacitor |
l |
Inductor |
v |
Voltage source |
s |
Switch |
w |
Wire |
o |
Oscilloscope/Output |
38 |
Slider control |
h |
Hint/display |
For complete documentation, see the CircuitJS documentation.
| Setting | Description | Default |
|---|---|---|
| Offline mode | Use bundled CircuitJS for offline support (desktop only) | true |
| Editable | Whether the embedded simulation can be interacted with | true |
| Show edit link | Show [EDIT] link to open circuit in full browser |
true |
| CircuitJS URL | Base URL for the CircuitJS application (used when offline mode is disabled) | https://falstad.com/circuit/circuitjs.html |
| Code block tag | Code block tag to trigger rendering | circuitjs |
File → Export As Text... in the simulation and paste the updated code back into your note# Clone the repository
git clone https://github.com/StevenGann/obsidian-circuitjs.git
cd obsidian-circuitjs
# Install dependencies
pnpm install
# Start development build (with watch mode)
pnpm dev
# Production build
pnpm build
# Run linting
pnpm lint
.obsidian/plugins/ directorypnpm dev to start the development build with hot reloadingCtrl+R to reload after changesThis project uses GitHub Actions for automated releases. Releases are deliberately triggered — not every commit creates a release.
Every push and pull request runs the CI workflow which:
npm run lint)npm run build)Update the version in package.json:
npm version patch # for bug fixes (1.0.0 → 1.0.1)
npm version minor # for new features (1.0.0 → 1.1.0)
npm version major # for breaking changes (1.0.0 → 2.0.0)
This automatically updates package.json, manifest.json, and versions.json.
Push the changes and tag:
git push && git push --tags
Create a GitHub Release:
1.0.1)Automated deployment:
main.js, manifest.json, and styles.css to the releaseObsidian's community plugin registry reads from your GitHub Releases. When you publish a release:
manifest.jsonmain.js, manifest.json, and optionally styles.csscircuitjs/
├── src/
│ ├── main.ts # Plugin entry point
│ ├── settings.ts # Settings interface and tab
│ └── circuitRenderer.ts # Circuit rendering and iframe logic
├── styles.css # Plugin styles
├── manifest.json # Obsidian plugin manifest
├── package.json # Node.js dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── esbuild.config.mjs # Build configuration
├── eslint.config.mjs # ESLint configuration
├── version-bump.mjs # Version bump script
├── versions.json # Version compatibility mapping
├── docs/
│ ├── screenshot.png # Documentation screenshot
│ └── MODERNIZATION.md # Modernization guide
└── README.md # This file
src/main.ts - Plugin Entry PointThe main plugin class CircuitJsPlugin extends Obsidian's Plugin class and:
circuitjs blocksCircuitRenderChildsrc/settings.ts - Settings ManagementContains the settings interface, default values, and the settings tab UI:
interface CircuitJsSettings {
editable: boolean; // Allow simulation interaction
editLink: boolean; // Show edit link
circuitJsUrl: string; // CircuitJS base URL
circuitTag: string; // Code block tag
}
src/circuitRenderer.ts - Rendering EngineThe CircuitRenderChild class extends MarkdownRenderChild and handles:
Data Flow:
Circuit Code → LZ Compression → URL Parameter → iframe src
| Package | Purpose |
|---|---|
obsidian |
Obsidian API types and base classes |
lz-string |
LZ-based compression for URL encoding |
esbuild |
Fast TypeScript bundler |
typescript |
TypeScript compiler |
typescript-eslint |
ESLint TypeScript support |
The plugin uses esbuild for building:
pnpm dev - Builds with watch mode and inline source mapspnpm build - Type-checked, optimized build with tree shaking and minificationOutput is a single main.js file in CommonJS format targeting ES2018.
git checkout -b feature/my-featurepnpm lintThis project is licensed under the MIT License.