Skip to main content

An mdformat plugin for `obsidian`.

Project description

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

Project details


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.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

mdformat_obsidian-0.0.3-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mdformat_obsidian-0.0.3.tar.gz
Algorithm Hash digest
SHA256 dc1c7da0569988b997f778447b7cb97d909a4231b988784548cfee5086813b71
MD5 fe422bb70784431d3ae1ef36279275a2
BLAKE2b-256 b7fdb6878f9135358a5394fb54e368917420f05d4341efd9625f2d354027554c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mdformat_obsidian-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 672b8938045718b7a5f5e365a286a6660c0c86df8b6fce6a2bfd8f642e004442
MD5 792f776e52718aca219917d6296edab0
BLAKE2b-256 d5398180e9bb6e64316b1b4f49cc2d02b3f84b19bc52fe4800de7a5288761edb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page