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

Motto Code Block

bugenbugen28 downloads

Enhance fenced code blocks (codeblocks) and code snippets with headers, line numbers, and folding. Display shell commands and ANSI output in a terminal-style layout.

Add to Obsidian
Motto Code Block screenshot
  • Overview
  • Scorecard
  • Updates2

command_block_figlet

Motto Code Block makes code blocks easier to read in Obsidian with theme-aware headers, line numbers, and folding. It also displays shell commands and their output in a terminal-style layout.

Features

  • Code block headers with language icons and custom titles.
  • Line numbers, folding, and partial previews.
  • ⭐ Command Block - Terminal-style command blocks with collapsible output.
  • ANSI colors for terminal output.
  • One-click copying for code, commands, and output.
  • Theme-aware styling in Live Preview and Reading view.

Code block enhancements

Code blocks adapt to your active Obsidian theme's colors and styling, in both light and dark modes.

Light mode Dark mode
Code block in light mode Code block in dark mode
  • Headers display language icons, language names, and optional custom titles. By default, they appear only when supported options such as title: or file: are present. Set Header display to Always in settings to show them on all eligible blocks.
  • Line numbers make code easier to follow, while preserving existing line wrapping.
  • Folding keeps long blocks compact. Click the header to fold or expand a block, or use a partial preview to show only the first few lines. Click Show all to reveal the rest.

Code block with a partial preview

Command Block

Command Block presents shell commands and their output in a terminal-style layout. Copy individual commands without prompts, show or hide output with a click, and display ANSI-colored output. Commands are displayed, not executed.

Command Block with shell commands and output

Extended syntax

Add options after the language name on the opening code fence. Quote values that contain spaces.

Option Description
title:"My code" or file:example.py Set the header title.
fold / expand Start folded / fully expanded.
expand:5 Show a partial preview of the first five lines.
header-style:info Color the header using an Obsidian callout type.
cmd Render a sh, bash, zsh, csh, or fish block as a Command Block.
prompt:"user@host:~/project" Show the user, host, and working directory in a Command Block header.
user:, host:, cwd: Set the prompt fields individually.
exclude Disable this plugin's enhancements for the block.

For example, file:manhattan_distance_contours.py adds a file name to a Python block's header:

```python file:manhattan_distance_contours.py
size_x, size_y = 15, 9
chars = "\u2588\u2593\u2592\u2591\u0020"

for y in range(-size_y, size_y + 1):
    line = ""
    for x in range(-size_x, size_x + 1):
        dist = abs(x) + abs(y)
        line += chars[dist % len(chars)] * 2
    print(line)
```

Python code block with a file name in the header

For a Command Block, combine cmd with an optional title and prompt. To include output, paste it into an ansi block directly after the shell block, with no blank line between the blocks:

```bash title:"Manhattan Distance Contours" prompt:bugen@localhost:/home/bugen
python manhattan_distance_contours.py
```
```ansi
... pasted output ...
```

Command Block displaying the output of a Python script

Theme and plugin compatibility

Code blocks retain Obsidian's syntax highlighting and use your active theme's colors by default, rather than a separate plugin color scheme.

Use Language include list and Language exclude list in settings to choose which languages are enhanced. Exclude languages handled by other plugins to help avoid rendering conflicts. Mermaid is excluded by default.

Acknowledgements

Thanks to these projects and their contributors:

  • Codeblock Customizer and Code Styler for serving as key references for this plugin's implementation.
  • vscode-icons and Devicon for their icon collections.
  • Anser and ansi-regex for ANSI parsing.
  • Font Awesome for an output toggle icon.

See THIRD_PARTY_NOTICES for attribution and license details.

Code blocks styled to match the active theme

HealthExcellent
ReviewSatisfactory
About
Make code blocks easier to read with theme-aware headers showing language icons and titles, optional line numbers, folding, and partial previews. Render shell commands and outputs in terminal-style blocks with ANSI colors, collapsible output, and one-click copying.
CodeAppearanceDevelopers
Details
Current version
0.1.1
Last updated
7 days ago
Created
Last week
Updates
2 releases
Downloads
28
Compatible with
Obsidian 1.5.0+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Author
bugenbugen
github.com/bugen
GitHubbugen
  1. Community
  2. Plugins
  3. Code
  4. Motto Code Block

Related plugins

CodeScript Toolkit

Allows to do a lot of things with JavaScript/TypeScript scripts from inside the Obsidian itself

CustomJS

Reuse custom JavaScript across desktop and mobile.

Minimal Theme Settings

Control the colors and fonts in Minimal Theme.

BRAT

Easily install a beta version of a plugin for testing.

Hider

Hide interface elements such as tooltips, status bar, titlebar, and more.

Templater

Create and use dynamic templates.

Claudian

Embeds Claude Code/Codex and other local Agents as AI collaborators in your vault.

Mermaid Tools

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

Local REST API with MCP

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

Terminal

Integrate consoles, shells, and terminals.