MkDocs plugin for converting and uploading Markdown pages to Confluence with automatic synchronization (via REST API)
Project description
mkdocs-to-confluence
A MkDocs plugin that automatically publishes your documentation to Atlassian Confluence. Convert Markdown pages to Confluence format and maintain synchronized documentation across platforms.
Full Documentation following Diataxis framework with :
- Tutorials (Learning-Oriented)
- How-To Guides (Task-Oriented)
- Reference (Information-Oriented)
- Explanation (Understanding-Oriented)
Table of Contents
- Features
- Installation
- Quick Start
- Configuration
- Usage Examples
- Markdown Support
- Troubleshooting
- Contributing
- License
Features
Core Capabilities
- Automated Publishing - Seamlessly publish MkDocs documentation to Confluence during builds
- Unlimited Hierarchy Depth - Support for arbitrary nesting levels
- Smart Updates - Creates new pages or updates existing ones based on title matching
- Intelligent Update Detection - Compares content before updating to skip unnecessary changes, reducing version bumps
- Orphaned Page Management - Automatically detects and optionally cleans up pages that no longer exist in your documentation, keeping your Confluence space in perfect sync
- Image Management - Automatically uploads and updates images as attachments with SHA1 hash-based change detection
Authentication & Security
- Multiple Authentication Methods - Supports Basic Auth, API tokens, and OAuth Bearer tokens
- Environment Variable Support - Secure credential management for CI/CD pipelines
Developer Experience
- Dry Run Mode - Export to filesystem for review before publishing to Confluence
- Conditional Publishing - Enable/disable based on environment variables
- Enhanced Markdown - Extended syntax support including strikethrough, admonitions, task lists, and more
- Comprehensive Logging - Verbose and debug modes with detailed content comparison
Installation
Install from PyPI
The recommended way to install mkdocs-to-confluence is via pip:
pip install mkdocs-to-confluence
Or add to your requirements.txt:
mkdocs>=1.1
mkdocs-to-confluence
Quick Start
API Token
- Go to Atlassian Account Settings
- Click "Create API token"
- Give it a name and copy the token
Space Key
Find your Confluence space key:
- Go to your Confluence space
- Click "Space Settings"
- The space key is shown in the URL:
https://your-domain.atlassian.net/wiki/spaces/SPACEKEY/
Configuration
Open your mkdocs.yml and add the plugin:
plugins:
- search # Keep your existing plugins
- mkdocs-to-confluence:
host_url: https://your-domain.atlassian.net/wiki/rest/api/content
space: YOUR_SPACE
parent_page_name: Documentation
Set up your Confluence credentials using environment variables (recommended):
export JIRA_USERNAME=your-email@example.com
export CONFLUENCE_API_TOKEN=your-api-token
!!! tip "Getting Your API Token" Generate an API token at Atlassian Account Settings
Alternatively, you can specify credentials directly in mkdocs.yml (not recommended for production):
plugins:
- mkdocs-to-confluence:
host_url: https://your-domain.atlassian.net/wiki/rest/api/content
space: DOCS
username: your-email@example.com
api_token: your-token # Better to use environment variable!
Orphaned Page Management
Keep your Confluence space in sync by automatically detecting and optionally cleaning up pages that no longer exist in your documentation:
plugins:
- mkdocs-to-confluence:
# ... other config ...
cleanup_orphaned_pages: false # Set to true to auto-delete orphaned pages
keep_pages: # Pages to preserve even if not in docs
- "Archive"
- "Manual Documentation"
page_label: auto-generated-docs # Label all synced pages for easy filtering
How it works:
- Always warns about orphaned pages (pages in Confluence but not in your docs)
- Optionally deletes them automatically when
cleanup_orphaned_pages: true - Preserves pages listed in
keep_pagesto protect manual content - See Managing Orphaned Pages for detailed strategies
For complete configuration options, see the Configuration Reference.
Markdown Support
See the Markdown Showcase and full documentation.
Troubleshooting
Common Issues
For detailed troubleshooting, see the full documentation.
Quick fixes:
- Authentication failed: Verify username and API token
- Space not found: Check space key (case-sensitive)
- Parent page not found: Create parent page in Confluence first
- Images not uploading: Check image paths in Markdown
Debug mode:
plugins:
- mkdocs-to-confluence:
debug: true # General debugging (API calls, operations)
debug_diff: true # Content comparison details (creates temp files)
verbose: true
Dry run testing:
plugins:
- mkdocs-to-confluence:
dryrun: true
export_dir: confluence-export
Requirements
- Python: >=3.8
- MkDocs: >=1.1
- Dependencies: jinja2, requests, mistune>=3.1.2, mime>=0.1.0
Contributing
Contributions are welcome! See the Contributing Guide for details.
Quick start:
git clone https://github.com/jmanteau/mkdocs-to-confluence.git
cd mkdocs-to-confluence
make py-setup
make py-test
License
This project is licensed under the MIT License - see the LICENSE file for details.
Third-Party Licenses
This project includes a vendored copy of md2cf (MIT License), which has been modified to support mistune 3.x and additional Confluence features.
Acknowledgments
- Original mkdocs-with-confluence by Paweł Sikora
- Original md2cf by Giacomo Gaino
- Enhanced md2cf fork by andrust with mistune 3.x support
- MkDocs documentation framework
Support
- Documentation: https://jmanteau.github.io/mkdocs-to-confluence/
- Issues: GitHub Issues
This README is auto-generated from documentation sources. Do not edit directly.
To update, modify the docs and run make readme
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mkdocs_to_confluence-0.6.0.tar.gz.
File metadata
- Download URL: mkdocs_to_confluence-0.6.0.tar.gz
- Upload date:
- Size: 314.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13dd12514ccab04c4adc076ff59220f9386ef0f7ab73319103e74a158d465539
|
|
| MD5 |
fa6051b0a4e7476640aed24d140fa1de
|
|
| BLAKE2b-256 |
1793621ac2fa687fb30dd8ba791d4861cf860b662465136f83e94d9ce1bd4f4b
|
File details
Details for the file mkdocs_to_confluence-0.6.0-py3-none-any.whl.
File metadata
- Download URL: mkdocs_to_confluence-0.6.0-py3-none-any.whl
- Upload date:
- Size: 43.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
749dc22cf28879477dcb4335b405bc25a598bf0d5828f9407d9d7a323f50228a
|
|
| MD5 |
d104bc369ac941577783f03fe041bce6
|
|
| BLAKE2b-256 |
edd54208fdc6a849b34b767750801d23f0fea08a4f89c3b5204ab29029d9dacb
|