mkdocs-open-in-new-tab
MkDocs plugin to open outgoing links and PDFs in new tab.
What it is and what it does
This plugin modifies the behavior of links in a MkDocs-generated site by injecting JavaScript that detects external links and files, then forces them to open in a new tab. It distinguishes between external URLs (by comparing hostname) and downloadable file types (PDF, Office documents, archives) and applies the `target="_blank"` and `rel="noopener"` attributes to them. Relative links within your documentation remain unaffected and open in the same tab.
The plugin is designed to improve user experience and accessibility by preventing external navigation from losing the reader's place in your documentation. It works by hooking into MkDocs' page context and injecting a small JavaScript file into every page. It includes optional styling to add a visual indicator (↗ arrow) next to links that will open in a new tab, and it explicitly handles compatibility with mkdocs-material's instant loading feature.
Use it for:
- Documentation sites that link to external resources and want to keep readers on the site.
- Adding visual indicators to external links for better UX and accessibility.
- Ensuring PDF downloads and file links open in new tabs without modifying Markdown.
- Sites using mkdocs-material that need consistent link behavior across instant-loaded pages.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A MkDocs plugin that injects JavaScript to automatically open external links and downloadable files (PDFs, documents, archives) in a new browser tab while keeping relative links in the same tab.
Yes, if you maintain a MkDocs site and want external links to open in new tabs without manual Markdown edits. The plugin is stable, has no security vulnerabilities, and adds minimal overhead. Dormant maintenance is acceptable here since the feature is simple and unlikely to break with MkDocs updates; however, verify compatibility with your specific MkDocs version and theme before relying on it for production.
Install
mkdocs-open-in-new-tab on PyPI
pip
pip install mkdocs-open-in-new-tabuv
uv add mkdocs-open-in-new-tabpoetry
poetry add mkdocs-open-in-new-tabInstalling mkdocs-open-in-new-tab
Before you install
Low friction: pure Python wheel with only mkdocs as a runtime dependency. Maintenance is dormant—last release was 634 days ago, though the repository remains active with a recent commit on 2024-11-18. Suitable for stable, feature-complete use cases.
License in practice
MIT license (permissive) means you can use, modify, and distribute this plugin freely in commercial and private projects with minimal restrictions.
Quickstart
pip install mkdocs-open-in-new-tab
Then add to mkdocs.yml:
plugins:
- open-in-new-tab
Optionally configure:
plugins:
- open-in-new-tab:
add_icon: true
Verify before relying
- Whether the plugin works correctly with all mkdocs-material versions, especially its instant loading feature.
- Performance impact when applied to sites with thousands of links.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — mkdocs |
| Maintenance | dormant — 634 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 197,746/month — #9,749 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mkdocs_open_in_new_tab-1.0.8-py3-none-any.whl
Keywords: mkdocs plugin, open in new tab, mkdocs, plugin, relative links, links
Tags
More Documentation packages
Docutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
SphinxSphinx generates professional documentation…
permissive · top 1,000 on PyPI
griffeGriffe extracts the complete structure and…
permissive · top 1,000 on PyPI
sphinxcontrib-serializinghtmlA Sphinx extension that outputs documentation…
permissive · top 1,000 on PyPI
alabasterAlabaster is a clean, responsive Sphinx theme…
permissive · top 1,000 on PyPI
sphinxcontrib-htmlhelpA Sphinx extension that generates HTML help…
permissive · top 1,000 on PyPI
mkdocs-link-markerA MkDocs plugin that automatically marks…
permissive · top 5,000 on PyPI
mkdocs-videoA MkDocs plugin that embeds videos in…
permissive · top 15,000 on PyPI
mkdocs-print-site-pluginMkDocs plugin that generates a combined print…
permissive · top 15,000 on PyPI
mkdocs-with-pdfGenerates a single PDF file from an MkDocs…
permissive · top 15,000 on PyPI
mkdocs-markdownextradata-pluginInjects mkdocs.yml extra variables into…
permissive · top 15,000 on PyPI
mkdocs-gen-filesMkDocs plugin that generates documentation…
permissive · top 5,000 on PyPI
mkdocs-awesome-pages-pluginA plugin for MkDocs that lets you customize…
permissive · top 5,000 on PyPI
mkdocs-simple-hooksA MkDocs plugin that lets you define custom…
permissive · top 15,000 on PyPI
mkdocs-table-reader-pluginA MkDocs plugin that inserts tables from…
permissive · top 15,000 on PyPI
mkdocs-autorefsA MkDocs plugin that automatically creates…
permissive · top 5,000 on PyPI