Skip to main content

asyncapi-tag

Render AsyncAPI documents inside Markdown pages with a single element:

<asyncapi-tag src="asyncapi.yaml"></asyncapi-tag>

asyncapi-tag is a Python-Markdown extension, so it works in any tool built on Python-Markdown. It ships with a plugin for MkDocs that resolves document paths the same way MkDocs resolves links. Rendering in the browser is done by the official AsyncAPI React component, pinned to an exact version and loaded with Subresource Integrity. JSON and YAML documents both work.

Formerly published as mkdocs-asyncapi-tag-plugin. See Migrating.

MkDocs

pip install asyncapi-tag
# mkdocs.yml
plugins:
  - asyncapi-tag

Put your AsyncAPI file anywhere under docs/ and reference it from a page. Paths are relative to the Markdown file, or relative to docs/ when they start with /. Absolute http(s):// URLs are passed through unchanged.

<!-- docs/api/events.md -->
# Events API

<asyncapi-tag src="events.yaml" sidebar="false"></asyncapi-tag>

A missing document or an invalid attribute is reported as a MkDocs warning, so mkdocs build --strict fails instead of shipping a broken page.

Plugin options

plugins:
  - asyncapi-tag:
      load_assets: true              # emit the viewer script and stylesheet (default: true)
      viewer_js: https://unpkg.com/@asyncapi/react-component@3.2.1/browser/standalone/index.js
      viewer_js_integrity: sha384-…  # set to '' to omit the integrity attribute
      viewer_css: https://unpkg.com/@asyncapi/react-component@3.2.1/styles/default.min.css
      viewer_css_integrity: sha384-…

To self-host the viewer, copy the two files into docs/ and point the options at them. Relative paths are resolved per page like src is:

plugins:
  - asyncapi-tag:
      viewer_js: assets/asyncapi/index.js
      viewer_js_integrity: ''
      viewer_css: assets/asyncapi/default.min.css
      viewer_css_integrity: ''

Or set load_assets: false and load the files yourself through extra_javascript and extra_css. The page-side runner script is still needed in that case; copy it from asyncapi_tag.assets.RUNNER_JS.

Plain Python-Markdown

import markdown

html = markdown.markdown(text, extensions=["asyncapi_tag"])

Extension options (pass them as extension_configs={"asyncapi_tag": {...}}):

Option Default Description
viewer_js, viewer_css pinned unpkg URLs Where to load the viewer from
viewer_js_integrity, viewer_css_integrity matching SRI hashes Empty string omits the attribute
load_assets True Emit the loader with the first tag on a page
url_resolver identity Callable mapping src (and relative asset URLs) to what the browser fetches
warn logging Callable receiving warning messages

Attributes

Only src is required. Attribute names are case-insensitive. Boolean attributes accept true/false, 1/0, yes/no, on/off; a bare attribute means true.

Attribute Values Default Effect
src path or URL required The AsyncAPI document (JSON or YAML)
id string asyncapi-tag-N HTML id of the container element
sidebar boolean true Show the navigation sidebar
info boolean true Show the info section
servers boolean true Show servers
operations boolean true Show operations
messages boolean true Show messages
schemas boolean true Show schemas
errors boolean true Show parser errors
showMessageExamples boolean viewer default Show examples for standalone messages
messageExamples boolean true Expand message examples
showServers byDefault, bySpecTags, byServersTags byDefault How the sidebar groups servers
showOperations byDefault, bySpecTags, byOperationsTags byDefault How the sidebar groups operations
useChannelAddressAsIdentifier boolean viewer default AsyncAPI v3: label operations by channel address
publishLabel, subscribeLabel string PUB, SUB Operation labels for AsyncAPI v2
sendLabel, receiveLabel, requestLabel, replyLabel string SEND, RECEIVE, REQUEST, REPLY Operation labels for AsyncAPI v3
parserOptions JSON object viewer default Passed to the AsyncAPI parser, e.g. parserOptions='{"applyTraits": false}'
schemaID string container id The viewer's schemaID option

These map onto the React component's configuration. Defaults for sidebar and messageExamples follow earlier releases of this plugin rather than the viewer, so existing pages keep their look.

How it works

Each tag becomes a <div class="asyncapi-tag"> carrying the document URL and the viewer configuration as HTML-escaped data attributes. The first tag on a page also emits the viewer's stylesheet and script and a short runner script. The runner fetches each document as text, hands it to AsyncApiStandalone.render, and prints a visible error inside the container if fetching or rendering fails. No content from the Markdown source is interpolated into JavaScript.

Tags inside fenced or indented code blocks are left alone, so you can document the syntax.

Material for MkDocs users with navigation.instant enabled are covered: the runner re-scans the page on Material's document$ event.

Migrating from mkdocs-asyncapi-tag-plugin

  1. Replace mkdocs-asyncapi-tag-plugin with asyncapi-tag in your requirements. The plugin id in mkdocs.yml is unchanged (asyncapi-tag).
  2. Remove the asyncapi_file plugin option. MkDocs already copies every non-Markdown file under docs/ into the site; the option now only prints a deprecation warning.
  3. Use a path relative to the page (or /-prefixed relative to docs/) in src. Earlier versions emitted the build machine's filesystem path, so only /-prefixed paths ever worked; those still work.
  4. String attributes such as publishLabel="PUBLISH" and showServers="bySpecTags" now take effect. Earlier versions silently discarded them.

mkdocs-asyncapi-tag-plugin 1.0.0 is a deprecated shim that only depends on this package, so upgrading it also works, but no further releases will be made under the old name.

Updating the pinned viewer

python scripts/update_viewer.py          # latest @asyncapi/react-component
python scripts/update_viewer.py 3.2.1    # specific version

The script rewrites the version, URLs and SRI hashes in src/asyncapi_tag/assets.py.

Development

python -m venv .venv && source .venv/bin/activate
pip install -e ".[test]"
pytest

The JavaScript runner is syntax-checked with node when it is installed. See AGENTS.md for the repository layout and release procedure.

License

MIT

Release files for asyncapi-tag 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyncapi-tag 1.0.0
File Size Uploaded
asyncapi_tag-1.0.0.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asyncapi-tag 1.0.0
File Interpreter ABI Platform
asyncapi_tag-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.1 kB

Release files / asyncapi_tag-1.0.0.tar.gz

Download URL asyncapi_tag-1.0.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
631f4aba754046954e85dbacfa3527c193906e66e4bb84ba84ebc8e30b1e7a0c
BLAKE2b-256 checksum
How to use checksums
bc9501842a1ee47a65836361674a7691c46b3caba3013c0ecea033d56dcd5f6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / asyncapi_tag-1.0.0-py3-none-any.whl

Download URL asyncapi_tag-1.0.0-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
352d2420a2f96ab4f3185b56636660dea120a523b56bf03dae35f0872d4cf7d0
BLAKE2b-256 checksum
How to use checksums
cd18f77817215ef1ed1784507a8e229b1ff3e06767fdeb244916186da29a8991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

1.1.0

2 release files

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page