skillfed

mkdocs-open-in-new-tab

MkDocs plugin to open outgoing links and PDFs in new tab.

mkdocs-open-in-new-tab v1.0.8 197.7K downloads/30d#9,749 on PyPI44
Permissive license MIT DORMANT released

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

uv

uv add mkdocs-open-in-new-tab

poetry

poetry add mkdocs-open-in-new-tab

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

mkdocs external links new tabmkdocs plugin open links new windowmkdocs pdf new tabmkdocs outgoing links target blankmkdocs link behavior pluginmkdocs accessibility new tab links
mkdocs-pluginlink-behavior

More Documentation packages

docutils

Docutils converts plaintext documentation in…

unclear · top 1,000 on PyPI

Sphinx

Sphinx generates professional documentation…

permissive · top 1,000 on PyPI

griffe

Griffe extracts the complete structure and…

permissive · top 1,000 on PyPI

sphinxcontrib-serializinghtml

A Sphinx extension that outputs documentation…

permissive · top 1,000 on PyPI

alabaster

Alabaster is a clean, responsive Sphinx theme…

permissive · top 1,000 on PyPI

sphinxcontrib-htmlhelp

A Sphinx extension that generates HTML help…

permissive · top 1,000 on PyPI

mkdocs-link-marker

A MkDocs plugin that automatically marks…

permissive · top 5,000 on PyPI

mkdocs-video

A MkDocs plugin that embeds videos in…

permissive · top 15,000 on PyPI

mkdocs-print-site-plugin

MkDocs plugin that generates a combined print…

permissive · top 15,000 on PyPI

mkdocs-with-pdf

Generates a single PDF file from an MkDocs…

permissive · top 15,000 on PyPI

mkdocs-markdownextradata-plugin

Injects mkdocs.yml extra variables into…

permissive · top 15,000 on PyPI

mkdocs-gen-files

MkDocs plugin that generates documentation…

permissive · top 5,000 on PyPI

mkdocs-awesome-pages-plugin

A plugin for MkDocs that lets you customize…

permissive · top 5,000 on PyPI

mkdocs-simple-hooks

A MkDocs plugin that lets you define custom…

permissive · top 15,000 on PyPI

mkdocs-table-reader-plugin

A MkDocs plugin that inserts tables from…

permissive · top 15,000 on PyPI

mkdocs-autorefs

A MkDocs plugin that automatically creates…

permissive · top 5,000 on PyPI