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

Scratchblocks

hayribakicihayribakici950 downloads

Render scratchblocks codeblocks

Add to Obsidian
Scratchblocks screenshot
Scratchblocks screenshot
Scratchblocks screenshot
  • Overview
  • Scorecard
  • Updates15

Render fenced scratchblock or scratchblocks code blocks in Obsidian. See the Scratch code documentation for the syntax.

Rendered Scratchblocks in Obsidian

Also supports inline blocks and local configuration.

Inline scratchblocks

Use sb <scratchcode> in order to display inline scratchblocks code with a sb prefix.

So writing

OMG, I guess a `sb when green flag clicked` snuck itself into the text.

will be rendered as:

OMG, I guess a a green flag block is displayed inline snuck itself into the text.

Local configuration

Add yaml frontmatter to override the global settings for the current note:

sb-lang: "it" # render Scratchblocks as Italian
sb-scale: 1.2 # render larger blocks

Note, that the scaling only affects the ``` fenced blocks. The inline blocks stay the same size.

Caveats and workarounds

One caveat for inline code is, that it may appear somewhat smaller than the surrounding text. This is due to the internal scale being different from the one used for multi-line codeblocks. CSS snippets can partly adjust the appearance to fit the user's font and line spacing (CSS snippets are described here, but better managed via plugins such as SnipDock).

For example, this CSS:

.scratchblocks-inline-rendered svg {
  display:inline-block;
  height:45px;            /* Adjust this to your desired overall height */
  margin-top: -15px;      /* Adjust to pull text back into the line spacing */
  margin-bottom: -15px;   /* top and bottom */
  vertical-align: middle; /* makes it even */
  width: auto;            /* necessary as well */
}

renders the above as[^1]:

image

Nested blocks will appear smaller because of necessary padding inserted by scratchblocks itself. For more details and a comparison with or without styling, see this wiki entry.

[^1]: The CSS required and final results will depend on vault-specific factors such as the theme.

Under the hood

This plugin uses the scratchblocks-ts package for rendering Scratchblocks.

Roadmap

See the roadmap for planned releases.

Contributing

To make changes to this plugin, first ensure you have the dependencies installed.

npm install

Translation

Check out the wiki entry on how to add translations.

Development

To start building the plugin with what mode enabled run the following command:

npm run dev

Note: If you haven't already installed the hot-reload-plugin you'll be prompted to. You need to enable that plugin in your obsidian vault before hot-reloading will start. You might need to refresh your plugin list for it to show up.

Releasing

To start a release build run the following command:

npm run build

Credits

This plugin started as a fork of shabegom's Scratchblocks plugin for Obsidian. Since that project hasn't been maintained, this repository tries to fill its shoes.


This plugin was generated by create-obsidian-plugin

HealthExcellent
ReviewSatisfactory
About
Render scratchblock code blocks written in scratch syntax directly in the editor.
VisualizationIntegrations
Details
Current version
0.0.21
Last updated
8 hours ago
Created
4 months ago
Updates
15 releases
Downloads
950
Compatible with
Obsidian 1.8.7+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Author
hayribakicihayribakicihayribakici
GitHubhayribakici
  1. Community
  2. Plugins
  3. Visualization
  4. Scratchblocks

Related plugins

Maps

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

Advanced Canvas

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

BRAT

Easily install a beta version of a plugin for testing.

Excalidraw

Visual PKM powerhouse. Create and edit Excalidraw drawings.

LanguageTool Integration

Advanced grammar and spell checking, powered by LanguageTool.

Self-hosted LiveSync

Sync vaults securely to self-hosted servers or WEBRTC.

Breadcrumbs

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

Fast Note Sync

Real-time sync of your vaults across server, mobile, and web; shareable with anyone; supports REST and MCP integrations to build your personal AI knowledge base.

Custom Frames

Turn web apps into panes using iframes with custom styling. Also comes with presets for Google Keep, Todoist and more.

Local REST API with MCP

Unlock your automation needs by interacting with your notes over a secure REST API.