Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Themes
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

CFR Mermaid Size

cferrugemcferrugem47 downloads

Drag any Mermaid diagram to resize it and right-click to align it. Desktop and mobile keep independent sizes, and everything is stored inside the block itself, so it survives re-renders and travels between your devices.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates1

Resize Mermaid diagrams in Obsidian by dragging, and align them left, center, or right. The size is stored inside the diagram block itself, so it survives re-renders, travels with the note through sync and Git, and works on any device.

Obsidian renders Mermaid diagrams at whatever size Mermaid computes, and offers no resize handle like it does for images. Existing zoom plugins let you zoom while you look, but nothing is remembered — reopen the note and the diagram is back to where it started.

How it works

Hover a diagram in reading view: a handle appears in the bottom-right corner. Drag it. When you release, the size is written into the block:

```mermaid
%% cfr-size: 50 %%
flowchart LR
  A --> B
```

Right-click the diagram to align it:

```mermaid
%% cfr-size: 50 %%
%% cfr-align: right %%
flowchart LR
  A --> B
```

%% is Mermaid's own comment syntax, so the diagram renders exactly the same with or without this plugin.

The keys

Key What it stores When absent
cfr-size width on desktop, 10–100% of the note width natural size, on desktop
cfr-size-mobile width on mobile natural size, on mobile
cfr-align left or right — applies everywhere centered (the default)

Sizes are a percentage of the note width, not pixels, so a diagram keeps its proportion on any screen.

Desktop and mobile are independent

Half of a monitor is comfortable; half of a phone screen is unreadable. Each device stores its own size and neither can see the other's: dragging on desktop touches only cfr-size, dragging on mobile touches only cfr-size-mobile.

The deliberate trade-off: a diagram you sized on desktop starts at its natural size on mobile until you adjust it there. Independence and inheritance are opposites — this plugin picks independence.

To clear a size, right-click (or long-press) the diagram and choose Clear desktop size / Clear mobile size. It removes that device's line only. You can also delete the line by hand.

Design notes

Why the state lives in the note. The obvious alternative is a plugin data file keyed by note path plus block index. That breaks the moment you insert a block above, rename the note, or edit on two devices — and it makes the data invisible to you. Keeping it in the block means sync and version control come for free, the value is readable and editable by hand, and uninstalling the plugin leaves nothing but a harmless Mermaid comment.

Why edits never target a stale line. The block's position in the file is resolved at the moment you click, never remembered from render time — a line number goes stale if the file changes underneath (sync, another edit). Writes go through Vault.process, which reads and writes atomically.

Where the handle does not appear. In Live Preview and inside embeds, Obsidian does not give the plugin the block's position in the file. Without a position there is no safe way to write, so the handle is not installed at all rather than risking a write to the wrong place.

Install

Not in the community plugin store yet. To install manually:

  1. Download main.js, manifest.json and styles.css from the latest release
  2. Put them in <your vault>/.obsidian/plugins/cfr-mermaid-size/
  3. Enable CFR Mermaid Size in Settings → Community plugins

Development

Plain JavaScript, single file, no build step — edit main.js and reload Obsidian.

npm test   # node --test, no dependencies

The text-manipulation core (lerMarcas, gravarMarcas, tamanhoParaDispositivo) is pure and covered by 43 tests that run without Obsidian.

Known limitations

  • The context menu is a reading view feature. In editing view the right-click menu belongs to the editor.
  • On mobile, a long press may not fire a context menu event. If it does not, write the %% cfr-align: %% line by hand.
  • Alignment has no visible effect on a diagram at 100% width — there is no slack to shift into.

License

MIT

HealthExcellent
ReviewSatisfactory
About
Resize Mermaid diagrams by dragging a bottom-right handle in reading view and align them left, center, or right via right-click. Store width and alignment as Mermaid comments inside the block so sizes persist across re-renders, sync and Git, using percentage widths with separate desktop and mobile values.
VisualizationFormatting
Details
Current version
0.4.0
Last updated
Last week
Created
Last week
Updates
1 release
Downloads
47
Compatible with
Obsidian 1.5.7+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Sponsor
Buy Me a Coffee
Author
cferrugemcferrugemcferrugem
GitHubcferrugem
  1. Community
  2. Plugins
  3. Visualization
  4. CFR Mermaid Size

Related plugins

Excalidraw

Visual PKM powerhouse. Create and edit Excalidraw drawings.

Advanced Canvas

Supercharge your canvas experience. Create presentations, flowcharts and more.

Breadcrumbs

Visualise the hierarchy of your vault using a breadcrumb trail or matrix view.

Maps

Adds a map layout to bases so you can display notes as an interactive map view.

Admonition

Admonition block-styled content.

Mermaid Tools

Improved Mermaid.js experience: visual toolbar with common elements and more.

ExcaliBrain

An interactive, structured mind-map of your Obsidian vault.

Linter

Format and style your notes. Linter can be used to format YAML tags, aliases, arrays, and metadata; footnotes; headings; spacing; math blocks; regular Markdown contents like list, italics, and bold styles; and more with the use of custom rule options.

Sort and Permute lines

Sort and Permute lines in whole file or selection.

Persistent Graph

Save and restore the positions of nodes on your graph.