mdformat-obsidian
An mdformat plugin for Obsidian Flavored Markdown.
Features
- Callouts - Alert-style blocks with custom titles and folding
- Supports all standard callout types (note, tip, warning, etc.)
- Custom callout types with any identifier
- Foldable callouts with
-or+indicators - Nested callouts
- Case-insensitive type matching (normalized to uppercase for compatibility)
- Inline Footnotes - Obsidian's
^[inline footnote]syntax - Task Lists - Extended checklist markers beyond
[x]and[ ]- Supports
[?],[/],[-], and other custom markers - Preserves marker style during formatting
- Supports
- Dollar Math - LaTeX math with
$...$and$$...$$delimiters- Inline math:
$E=mc^2$ - Block math:
$$\n...\n$$
- Inline math:
[!NOTE] The format for GitHub Alerts differs slightly from Obsidian callouts. Obsidian supports folding, custom titles, and is case-insensitive. For improved interoperability, this package normalizes callout types to uppercase (e.g.,
[!tip]→[!TIP]).
mdformat Usage
Add this package wherever you use mdformat and the plugin will be auto-recognized. No additional configuration necessary. See additional information on mdformat plugins here
Tip: this package specifies an "extra" ('recommended') for plugins that work well with GFM:
- mdformat-beautysh
- mdformat-black
- mdformat-config
- mdformat-frontmatter
- mdformat-simple-breaks
- mdformat-web
- mdformat-wikilink
pre-commit / prek
repos:
- repo: https://github.com/executablebooks/mdformat
rev: 1.0.0
hooks:
- id: mdformat
additional_dependencies:
- mdformat-obsidian
# - "mdformat-obsidian[recommended]"
uvx
uvx --with=mdformat-obsidian mdformat
Or with pipx:
pipx install mdformat
pipx inject mdformat mdformat-obsidian
HTML Rendering
To generate HTML output, use obsidian_plugin from mdit_plugins. This combines all Obsidian-flavored markdown features (callouts, footnotes, task lists, math). For more details, see the markdown-it-py documentation.
from markdown_it import MarkdownIt
from mdformat_obsidian.mdit_plugins import obsidian_plugin
md = MarkdownIt()
md.use(obsidian_plugin)
text = "> [!tip] Callouts can have custom titles\n> Like this one."
md.render(text)
# <div>
# <div data-callout-metadata="" data-callout-fold="" data-callout="tip" class="callout">
# <div class="callout-title">
# <div class="callout-title-inner">Callouts can have custom titles</div>
# </div>
# <div class="callout-content">
# <p>Like this one.</p>
# </div>
# </div>
# </div>
Accessibility Note: For improved semantics, callouts are rendered as <div> elements rather than <blockquote>. The > syntax is repurposed for callouts (not quotations), so using div elements better represents the content structure. See discussion on GitHub.
Caveats
- LaTeX Math: Direct
\begin{...}LaTeX environments are not supported. Use dollar math syntax ($...$or$$...$$) instead. - HTML Output Only: The HTML rendering features are designed for programmatic HTML generation. For markdown-to-markdown formatting (the primary mdformat use case), these renderers are not invoked.
- GitHub Compatibility: While callouts work in both Obsidian and GitHub, subtle formatting differences exist. This plugin prioritizes Obsidian compatibility.
Contributing
See CONTRIBUTING.md
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdformat_obsidian-0.3.0.tar.gz.
File metadata
- Download URL: mdformat_obsidian-0.3.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
872f22459d001d5b384605fdef8fab633dab1b8e30dce6f3fa4ed1b108ddaca6
|
|
| MD5 |
ec01125ba4c9b796bd18d2b8c159f64a
|
|
| BLAKE2b-256 |
5a9806b1c6dae603605cb67a329fdaa10ddb9382e104d46f87be569331b14c25
|
Provenance
The following attestation bundles were made for mdformat_obsidian-0.3.0.tar.gz:
Publisher:
tests.yml on KyleKing/mdformat-obsidian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdformat_obsidian-0.3.0.tar.gz -
Subject digest:
872f22459d001d5b384605fdef8fab633dab1b8e30dce6f3fa4ed1b108ddaca6 - Sigstore transparency entry: 2195038235
- Sigstore integration time:
-
Permalink:
KyleKing/mdformat-obsidian@20c46c9c53027702e1a56839b9ddbca391cd79f3 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/KyleKing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
tests.yml@20c46c9c53027702e1a56839b9ddbca391cd79f3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mdformat_obsidian-0.3.0-py3-none-any.whl.
File metadata
- Download URL: mdformat_obsidian-0.3.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
215294a5bce45ccbd9503f18a12c1102e0dde2e4463c8c97f9af0d388518e60b
|
|
| MD5 |
530eb5dade99915b789dab5b530ca0c8
|
|
| BLAKE2b-256 |
1ca395b791345556c024304728d3b1b02a1752c24acbca36165fad3111a355db
|
Provenance
The following attestation bundles were made for mdformat_obsidian-0.3.0-py3-none-any.whl:
Publisher:
tests.yml on KyleKing/mdformat-obsidian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdformat_obsidian-0.3.0-py3-none-any.whl -
Subject digest:
215294a5bce45ccbd9503f18a12c1102e0dde2e4463c8c97f9af0d388518e60b - Sigstore transparency entry: 2195038246
- Sigstore integration time:
-
Permalink:
KyleKing/mdformat-obsidian@20c46c9c53027702e1a56839b9ddbca391cd79f3 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/KyleKing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
tests.yml@20c46c9c53027702e1a56839b9ddbca391cd79f3 -
Trigger Event:
push
-
Statement type: