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-codeblock

Based on the mkdocs-callouts extension.

Dependency package

Obsidian-Plugin: codeblock-customizer

Setup

Install the plugin using pip:

pip install mkdocs-callouts-codeblock

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.

mkdocs-codeblock converts the following:

{
  "welcomeBack": "欢迎回来",
  "pageTitle": "测试项目系统",
  "pageDesc": "更快、更简单、更安全的测试项目系统",
  ...
  }
{
  "welcomeBack": "Welcome Back",
  "pageTitle": "Test System",
  "pageDesc": "Faster, simpler and safer Test projects",
  ...
}

and turns it into:

=== "中文"

```js title="packages\locales\src\langs\zh-CN\authentication.json" hl_lines="3 4" linenums="11" 
{
  "welcomeBack": "欢迎回来",
  "pageTitle": "测试项目系统",
  "pageDesc": "更快、更简单、更安全的测试项目系统",
  ...
  }
```

=== "English"

```js title="packages\locales\src\langs\en-US\authentication.json" hl_lines="3 4" linenums="11" 
{
  "welcomeBack": "Welcome Back",
  "pageTitle": "Test System",
  "pageDesc": "Faster, simpler and safer Test projects",
  ...
}
```

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_codeblock-1.16.5.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

mkdocs_callouts_codeblock-1.16.5-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_callouts_codeblock-1.16.5.tar.gz.

File metadata

File hashes

Hashes for mkdocs_callouts_codeblock-1.16.5.tar.gz
Algorithm Hash digest
SHA256 7a359c8e9009e04decbe1a1219b576aa91e184c2224f21857d6f495cb3f86022
MD5 6b0ad68a97b365c22ea5607d35fa0734
BLAKE2b-256 6a0359aa73f694a61bb2f3b366562a35ef00d0e1a69bd05ce816559ea3277306

See more details on using hashes here.

File details

Details for the file mkdocs_callouts_codeblock-1.16.5-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_callouts_codeblock-1.16.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a01b8eed73ed4b336521a8647501e2a536348da727fea1a6244eeae7a2d28488
MD5 b1162da2a46256f801086bf8de701102
BLAKE2b-256 13d9dc520a90a5c515a03f036784f8da6a3e1e9e165370a4f1f6d7b48f3348a5

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 Pingdom Monitoring Sentry Error logging StatusPage Status page