Skip to main content

mdformat-obsidian

Build Status PyPI version

An mdformat plugin for Obsidian Flavored Markdown. This plugin directly supports Callouts and defers the rest of the formatting to additional plugins installed automatically.

[!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.16
    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>

# </blockquote>

[!WARNING] This package does not properly handle replacing the blockquote outer div with a div for accessibility. This should be possible with markdown-it, but I haven't yet found a way.

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.0.2.tar.gz (10.7 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.0.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mdformat_obsidian-0.0.2.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for mdformat_obsidian-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a33978de6242089a9e0c1928a4bc1748f2de2e2e95528645de9c3897277ec486
MD5 f905d362e318dc862248f42100011237
BLAKE2b-256 3c4622ab733ddb1271545d1dca0d53df13ffd29a16de8d67c5f43fc9f4006573

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mdformat_obsidian-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f9bc0bdb1d8bbd5004e1b165531517da028e8f5db07a03d4dacf7b327195c714
MD5 35d9a5accdda549dae23f4723ca90ac6
BLAKE2b-256 2229c6b1b23a234bfc696c41611a98ae7479499a9d19bf4e319c004087c41ccf

See more details on using hashes here.

Supported by

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