Skip to main content

A simple plugin that converts Obsidian style callouts and converts them into mkdocs supported 'admonitions' (a.k.a. callouts).

Project description

mkdocs-callouts

Build Status GitHub latest commit PyPi MIT license codecov

A simple plugin that converts Obsidian style callouts and converts them into mkdocs supported 'admonitions' (a.k.a. callouts).

Setup

Install the plugin using pip:

pip install mkdocs-callouts

Activate the plugin in mkdocs.yml, note that some markdown_extensions are required for this plugin to function correctly:

markdown_extensions:
  - nl2br
  - admonition
  - pymdownx.details
  - pymdownx.superfences

plugins:
  - search
  - callouts

Note: If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set, but now you have to enable it explicitly.

Usage

mkdocs-callouts converts the following:

> [!INFO] Title
> An information callout from Obsidian
> inspired by the syntax from the Microsoft Docs

and turns it into:

!!! info "Title"
    An admonition block for MkDocs.
    Allowing you to edit your notes
    with confidence using Obsidian.

Foldable blocks

Foldable blocks are also supported. (> [!INFO]- Foldable closed by default, > [!INFO]+ Foldable open by default)

Inline blocks

To turn a callout block into an inline block you can use the |left or |right syntax in the type notation like so:

> [!INFO|left] -> !!! info inline (alt: [!INFO | left])
> [!INFO|inline] -> !!! info inline

> [!INFO|right] -> !!! info inline end 
> [!INFO|inline end] -> !!! info inline end

The following also works, but Obsidian may not render the block type correctly.

> [!INFO inline] --> !!! info inline
> [!INFO inline end] --> !!! info inline end

To get more information about inline blocks, or how to add your own custom callout blocks, check the Material Mkdocs Documentation.

Aliases

Obsidian allows the use of aliases when creating callouts, mkdocs-callouts converts these to the corresponding block type. Should you wish to disable this behaviour then you can do so by setting aliases to false in the plugin configuration:

plugins:
  - search
  - callouts:
      aliases: false

Breakless lists (New in 1.11.0)

Markdown specification requires a blank line between list items and other block elements, whereas Obsidian does not require this. This plugin will by default automatically add a blank line between list items and callout blocks (if none are present). Should you wish to disable this behaviour then you can do so by setting breakless_lists to false in the plugin configuration:

plugins:
  - search
  - callouts:
      breakless_lists: false

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

mkdocs_callouts-1.16.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

mkdocs_callouts-1.16.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_callouts-1.16.0.tar.gz.

File metadata

  • Download URL: mkdocs_callouts-1.16.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for mkdocs_callouts-1.16.0.tar.gz
Algorithm Hash digest
SHA256 d3248eb99b7acb00ba6526e183ca58d3f7083fb3cfa1739f74f8377e71002aec
MD5 6612ab65866a0707a930664ca1af5fd7
BLAKE2b-256 5a1be20a9930d68f03e62af1d7c571c9b333f6a6f447d094bff9024562b129aa

See more details on using hashes here.

File details

Details for the file mkdocs_callouts-1.16.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_callouts-1.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01ed1511045d61c05b072e4af42d68ef03a1863b7cfcc582bdbb676f26ffdf62
MD5 5a05680472a5ccaa7f696c22649d940d
BLAKE2b-256 29709f3d3e682333e77a76ab855df63b8ada97c46e142ff30d54299a2e362bea

See more details on using hashes here.

Supported by

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