Skip to main content

A MkDocs plugin to publish documentation to Confluence

Project description

MkDocs Confluence Publisher Plugin

[!CAUTION] This is a hard fork of the original mkdocs-confluence-publisher. This version is unmaintained and is published to PyPI as ss-mkdocs-confluence-publisher.

This version adds the following features:

  • Orphan Page Support: Automatically creates pages in Confluence for Markdown files not listed in mkdocs.yml, preserving directory hierarchy.
  • Page Pruning: Automatically deletes Confluence pages that no longer exist in your MkDocs source (optional).
  • Robust Title Extraction: Automatically extracts page titles from the first H1 tag in Markdown files or falls back to capitalized filenames.
  • Native Task Lists: Maps Markdown checkboxes (- [ ], - [x]) to native interactive Confluence task list macros.
  • Enhanced Markdown Support:
    • Admonitions: Full support for standard Markdown admonitions (!!! note, etc.) mapped to corresponding Confluence macros (info, tip, note, warning).
    • Expandable Sections: Support for pymdownx.details (??? expand) syntax using Confluence's expand macro.
    • Table of Contents: Support for [TOC] markers mapped to Confluence's native TOC macro.
    • Horizontal Rules: Maps Markdown --- to native Confluence <hr /> elements.
  • Improved Attachment Handling: Better detection and uploading of local images.
  • Internal Link Validation: Automatically validates that same-page internal links (anchors) match the casing of the target headings. This prevents issues with Confluence's case-sensitive anchor system.
  • Modern Build System: Built with hatchling and optimized for use with uv.

This MkDocs plugin automatically publishes your documentation to Confluence. It creates a hierarchical structure in Confluence that mirrors your MkDocs site structure, updates page content, and handles attachments.

Features

  • Automatically creates and updates pages in Confluence
  • Maintains the hierarchy of your MkDocs site in Confluence
  • Handles attachments referenced in your markdown files
  • Configurable page prefix for easy identification in Confluence

Installation

Install the plugin using uv:

uv pip install ss-mkdocs-confluence-publisher

Configuration

Add the following to your mkdocs.yml:

plugins:
  - confluence-publisher:
      confluence_prefix: "MkDocs - "  # Optional: Prefix for page titles in Confluence
      confluence_suffix: " - MkDocs"  # Optional: Suffix for page titles in Confluence
      space_key: "YOUR_SPACE_KEY"     # Required: Confluence space key
      parent_page_id: 123456          # Required: ID of the parent page in Confluence
      prune_orphans: false            # Optional: If true, deletes Confluence pages that are no longer in MkDocs

Environment Variables

The plugin requires the following environment variables to be set:

  • CONFLUENCE_URL: The base URL of your Confluence instance
  • CONFLUENCE_USERNAME: Your Confluence username
  • CONFLUENCE_API_TOKEN: Your Confluence API token

You can set these in your environment or use a .env file.

Usage

Once configured, the plugin will automatically publish your documentation to Confluence when you build your MkDocs site:

mkdocs build

How It Works

  1. Initialization: The plugin connects to Confluence using the provided credentials.
  2. Page Creation: It creates a structure in Confluence mirroring your MkDocs navigation.
  3. Content Update: As it processes each page, it updates the content in Confluence.
  4. Attachment Handling: Any attachments referenced in your markdown are uploaded to the corresponding Confluence page.

Logging

The plugin uses Python's logging module. You can configure logging in your mkdocs.yml:

logging:
  level: INFO

Set to DEBUG for more detailed logging information.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache-2.0 license.

Project details


Download files

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

Source Distribution

ss_mkdocs_confluence_publisher-0.2.0.tar.gz (51.5 kB view details)

Uploaded Source

Built Distribution

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

ss_mkdocs_confluence_publisher-0.2.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file ss_mkdocs_confluence_publisher-0.2.0.tar.gz.

File metadata

  • Download URL: ss_mkdocs_confluence_publisher-0.2.0.tar.gz
  • Upload date:
  • Size: 51.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ss_mkdocs_confluence_publisher-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ed31e2ee20701937d55f6c87c3a348e144f3052b359877df7ab314f7e3f02501
MD5 3fa3a309d74e5945447d14d89ccfb0fc
BLAKE2b-256 408ce7ca0806e1191d8ca8561d8fa2c39da59feafcd936386b0bc746d315940a

See more details on using hashes here.

File details

Details for the file ss_mkdocs_confluence_publisher-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ss_mkdocs_confluence_publisher-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ss_mkdocs_confluence_publisher-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3bba2613af25a496b830f0d5437897d94d54c9c5d8b23baf94fbfe3f6e003df
MD5 721396cd34b74a99bfaa9f4a12389669
BLAKE2b-256 a228e6ee85ad6eb61a1fb7d3f68d48a021ec467f146fb46679c4e632b1211a7f

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