Skip to main content

Publish MkDocs Material pages to Confluence Cloud — admonitions, Mermaid diagrams, tabs, page properties and more

Project description

mk2conf — MkDocs / Zensical to Confluence

License: GPL v3 Python 3.12+ PyPI Downloads Latest Release CI Release codecov Ruff mypy security: bandit SLSA Level 3 OpenSSF Scorecard

A Python CLI tool that compiles MkDocs-flavoured Markdown into native Confluence storage XHTML and publishes it directly to Confluence Cloud. It is a compiler/transpiler, not an HTML converter — every construct maps to its native Confluence equivalent, so pages look and behave like hand-authored Confluence content.

It also bridges the gap between Confluence reviewers and developers: the sync-comments command turns open Confluence page comments into GitHub pull request review threads, and auto-resolves them in Confluence when the PR is merged.

Zensical compatibleZensical is the modern successor to MkDocs + Material for MkDocs. Since it uses the same mkdocs.yml format and Python Markdown extensions, your Zensical project works with mk2conf today with no changes required.


Installation

Requires Python 3.12+. The PyPI package is mkdocs2confluence; the CLI command is mk2conf.

pip install mkdocs2confluence
# or, for an isolated install:
pipx install mkdocs2confluence

From source (see Setup.md):

git clone https://github.com/jeckyl2010/mkdocs2confluence.git
cd mkdocs2confluence && uv sync

GitHub Actions

Publish docs automatically on every push — no local install needed:

- name: Publish docs to Confluence
  uses: jeckyl2010/mkdocs2confluence@v1
  with:
    token: ${{ secrets.CONFLUENCE_API_TOKEN }}

Full workflow — triggers on changes to docs/ or mkdocs.yml:

name: Publish docs

on:
  push:
    branches: [main]
    paths: ['docs/**', 'mkdocs.yml']

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: jeckyl2010/mkdocs2confluence@v1
        with:
          token: ${{ secrets.CONFLUENCE_API_TOKEN }}
          prune: 'true'

Available inputs: token (required), config, version, dry-run, section, page, prune, quiet. See docs/commands.md for details.


Quick start

# Preview a page locally (no Confluence API calls)
mk2conf preview --page index.md --watch

# Dry-run: see what would be published
mk2conf publish --dry-run

# Publish all nav pages
mk2conf publish

# Export a section to PDF
mk2conf pdf --section Guide --out guide.pdf

# Sync Confluence comments to GitHub PR review threads
mk2conf sync-comments

Configuration

Add a confluence: block to your mkdocs.yml:

confluence:
  base_url: https://yourorg.atlassian.net
  space_key: TECH
  email: user@example.com
  token: !ENV CONFLUENCE_API_TOKEN   # never hardcode the token
  parent_page_id: "123456"           # optional root page
  mermaid_render: kroki              # "kroki" (default) | "kroki:https://your-kroki" | "none"
  full_width: true                   # default: true
  changelog: CHANGELOG.md           # optional: publish as a top-level "What's New" page

The confluence: block is also accepted under extra: for MkDocs strict-mode compatibility. The API token is read from token: in mkdocs.yml, then CONFLUENCE_API_TOKEN, then MK2CONF_TOKEN.

Changelog / What's New page

Set changelog: to a Markdown file path (relative to docs_dir) to have mk2conf publish it as a permanent top-level page on every full mk2conf publish run. The page title comes from YAML front matter title:; it defaults to "What's New" if absent.

confluence:
  changelog: CHANGELOG.md   # relative to docs_dir
  • The page does not need to appear in nav: — it is always placed at the top level of the space (or under parent_page_id if set).
  • If it also appears in nav:, it is published once; no duplication.
  • --prune never deletes it — it is a pinned page, not a nav-derived page.
  • Partial runs (--page / --section) skip the changelog page, consistent with other publish behaviour.
  • Omit the key, or set it to an empty string, to disable the feature entirely.

Run mk2conf install-skill once after setting changelog: to install the changelog AI skill into your AI tool (Claude Code, Copilot, Cursor, Hermes). The skill analyses git changes to your docs since the last CHANGELOG.md commit and drafts an entry when the changes qualify as significant.

Your first publish:

export CONFLUENCE_API_TOKEN=your_api_token_here
mk2conf preview --page docs/index.md --watch   # verify output locally
mk2conf publish --dry-run                       # check the plan
mk2conf publish                                 # go live

Documentation

docs/commands.md Full flag reference for all five commands
docs/features.md Supported Markdown / Material features and known limitations
Setup.md Development environment setup

Architecture

Architecture

Pipeline stages: loader → preprocess → IR → transforms → emitter → publisher.

The publisher is split into two phases:

  • planner.py builds a nav-ordered publish plan, compiles pages, and makes the read-side API calls needed to decide create vs update vs skip.
  • executor.py applies that plan, performs the write-side API calls, uploads attachments, and wires parent/child relationships in nav order so parent pages always exist before their children.

publisher/pipeline.py remains a compatibility facade that re-exports the public publish surface used by the CLI and tests.


Development

uv run pytest -q
uv run ruff check src tests
uv run mypy src
uv run vulture src --min-confidence 80

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs2confluence-0.13.1.tar.gz (199.0 kB view details)

Uploaded Source

Built Distribution

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

mkdocs2confluence-0.13.1-py3-none-any.whl (137.3 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs2confluence-0.13.1.tar.gz.

File metadata

  • Download URL: mkdocs2confluence-0.13.1.tar.gz
  • Upload date:
  • Size: 199.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mkdocs2confluence-0.13.1.tar.gz
Algorithm Hash digest
SHA256 8e043c24794ae812db5875edd4165470989a3eef9eda08981a3604b5608a6775
MD5 7b745970320cdf95fd6fcfee3e8d943b
BLAKE2b-256 8b9c39f50d3076ccdaecbe5af0050e2205166d44e89ee747e138d261da2197da

See more details on using hashes here.

File details

Details for the file mkdocs2confluence-0.13.1-py3-none-any.whl.

File metadata

  • Download URL: mkdocs2confluence-0.13.1-py3-none-any.whl
  • Upload date:
  • Size: 137.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mkdocs2confluence-0.13.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e62e10aa2929a0fe42a1a0159ca3f6ceb3a1f144ab395ff26496e00347b72fe8
MD5 60015f759e8d9afc3580d65790b7d346
BLAKE2b-256 19bbe652b0d1462d30c923ebec7f72605d65d48713cbc64f6ab30a4312474c9c

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