Skip to main content

mdformat-obsidian

Build Status PyPI version

An mdformat plugin for Obsidian Flavored Markdown. This plugin directly supports Callouts, inline footnotes, task lists with custom markers, and dollar math. See the test directory for supported formats.

[!NOTE] The format for GitHub Alerts differs slightly from Obsidian, so they are not fully compatible. Obsidian supports folding, custom titles, and is case insensitive. To improve interoperability, this package makes the stylistic choice of capitalizing the text within [!...].

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:

Pre-Commit

repos:
  - repo: https://github.com/executablebooks/mdformat
    rev: 0.7.18
    hooks:
      - id: mdformat
        additional_dependencies:
          - mdformat-obsidian
          # Or
          # - "mdformat-obsidian[recommended]"

pipx

pipx install mdformat
pipx inject mdformat mdformat-obsidian
# Or
# pipx inject mdformat "mdformat-obsidian[recommended]"

HTML Rendering

To generate HTML output, obsidian_plugin can be imported from mdit_plugins. For more guidance on MarkdownIt, see the docs: https://markdown-it-py.readthedocs.io/en/latest/using.html#the-parser

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)
# <blockquote>
# <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>
# </blockquote>

[!WARNING] The outer <blockquote> tag is preserved to maintain compatibility with standard Markdown parsers. For full accessibility, you may want to replace this with a <div> in post-processing, as the > blockquote syntax is being repurposed for callouts.

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

mdformat_obsidian-0.2.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdformat_obsidian-0.2.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file mdformat_obsidian-0.2.0.tar.gz.

File metadata

  • Download URL: mdformat_obsidian-0.2.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mdformat_obsidian-0.2.0.tar.gz
Algorithm Hash digest
SHA256 41dfa70b05bb6885b2e737dc2af894875ff6e32fb74883a2ec9df7c3df62227e
MD5 3636fadd54423246ef80fb16601c3bb6
BLAKE2b-256 8f9a1c777df7303ecf2c1052f76c37793593c6ae7ad77156fb3be2cd3138a5a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdformat_obsidian-0.2.0.tar.gz:

Publisher: tests.yml on KyleKing/mdformat-obsidian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mdformat_obsidian-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mdformat_obsidian-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4413c5654ca57429acd3e853181ece82135b38659993113dad5aabbb2ef3c33f
MD5 69256a06e65ed41ba8a38eaa03f359a0
BLAKE2b-256 a9def11bfd7042485c058849a67df79d301458b29a6d6610bf7cbca85c5b5e14

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdformat_obsidian-0.2.0-py3-none-any.whl:

Publisher: tests.yml on KyleKing/mdformat-obsidian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page