skillfed

mkdocs-swagger-ui-tag

A MkDocs plugin supports for add Swagger UI in page.

mkdocs-swagger-ui-tag v0.8.1 283.1K downloads/30d#8,080 on PyPI113
Permissive license MIT Active released

What it is and what it does

This plugin extends MkDocs by allowing you to embed interactive Swagger UI viewers directly into your documentation pages using a simple HTML tag. Instead of linking to external API documentation or hosting Swagger UI separately, you add a `<swagger-ui>` tag pointing to an OpenAPI specification file—either a remote URL or a local file in your docs folder—and the plugin converts it into an embedded iframe with full Swagger UI functionality.

The plugin handles all the heavy lifting: it copies Swagger UI's JavaScript and CSS assets into your site's static directories, generates the necessary iframe HTML, and supports multiple Swagger UIs on the same page. It integrates with Material for MkDocs' dark mode, lets you configure Swagger UI behavior through plugin options (like operation expansion, syntax highlighting theme, and Try It Out settings), and supports OAuth2 flows. All assets are served locally rather than from a CDN, making it suitable for intranet deployments.

Use it for:

  • Embed API documentation directly in MkDocs sites alongside other guides and tutorials without maintaining separate Swagger UI hosting.
  • Display multiple OpenAPI specs in one documentation site with a selector bar to switch between them.
  • Support OAuth2-protected API testing in embedded Swagger UI with configurable redirect URLs.
  • Serve Swagger UI entirely from local assets in air-gapped or intranet environments without CDN access.
  • Customize Swagger UI appearance and behavior per-page through tag attributes while keeping global defaults in mkdocs.yml.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A MkDocs plugin that embeds Swagger UI directly into documentation pages to display OpenAPI specifications, supporting both remote URLs and local files.

Yes. The plugin is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real problem for teams documenting APIs in MkDocs. It's particularly valuable if you want to avoid hosting Swagger UI separately or need to serve API docs in restricted network environments.

Install

mkdocs-swagger-ui-tag on PyPI

pip

pip install mkdocs-swagger-ui-tag

uv

uv add mkdocs-swagger-ui-tag

poetry

poetry add mkdocs-swagger-ui-tag

Installing mkdocs-swagger-ui-tag

Before you install

Low friction install with a single runtime dependency (beautifulsoup4). Active maintenance with a recent release (35 days ago) and steady repository activity.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install mkdocs-swagger-ui-tag

Add to mkdocs.yml:
plugins:
  - swagger-ui-tag

In markdown:
<swagger-ui src="https://petstore.swagger.io/v2/swagger.json"/>

Requires MkDocs to be installed and a valid mkdocs.yml configuration file in your project.

Verify before relying

  • Whether the plugin requires Node.js or npm to be installed separately for Swagger UI dist files
  • Compatibility with MkDocs versions beyond the Python version support range

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — beautifulsoup4
Maintenance actively maintained — 35 days since the last release
Last repo commit
First released
Downloads 283,110/month — #8,080 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mkdocs_swagger_ui_tag-0.8.1-py3-none-any.whl

Keywords: mkdocs, openapi, plugin, swagger-ui

Development Status :: 5 - Production/StableEnvironment :: ConsoleEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: DocumentationTopic :: Text Processing

Tags

mkdocs swagger ui pluginopenapi documentation embedswagger ui markdown tagapi documentation mkdocsopenapi spec viewermkdocs api docsswagger integration mkdocs
api-documentationmkdocs-pluginopenapi

More Text Processing packages