markdown-to-confluence is a Python library and command-line tool (md-to-conf) designed to publish Markdown files to Confluence wikis. It parses Markdown, converts its content into Confluence Storage Format (XHTML), and invokes Confluence API endpoints to upload pages and attachments (like images). It supports single-page and directory synchronization modes, handling relative links and page hierarchies. The current version is 0.5.8 and it appears to be actively maintained with a focus on ease of use for documentation synchronization.
pip install markdown-to-confluenceVerified import paths — ran on the pinned version, not inferred.
The `markdown-to-confluence` library is primarily used via its command-line interface, `md-to-conf`. This quickstart demonstrates how to publish a single Markdown file to a specified Confluence space using environment variables for authentication. Replace placeholder values with your actual Confluence organization name, username (email), and API key.
Ensure `ATLASSIAN_ORGNAME` (e.g., 'yourcompany' for 'yourcompany.atlassian.net'), `ATLASSIAN_USERNAME`, and a valid `ATLASSIAN_API_KEY` are correctly configured. Verify the API key has necessary permissions to create/update pages in the target space. Refer to Atlassian's documentation for generating API tokens.
Double-check the `--space` key and `--ancestor` page title for exact matches (including case and punctuation) against your Confluence instance. Ensure the authenticated user has permissions to view the specified space and ancestor page.
For reliable image rendering, especially for diagrams, provide PNG alternatives for SVG images. Consider using Mermaid diagrams with the optional `mmdc` CLI for better rendering, which will be converted to PNG.
For documents with inter-page relative links, use the directory publishing mode. Ensure all linked Markdown files are part of the directory being published. External images referenced by absolute URLs retain their original URL.
Test complex Markdown features after publishing to ensure they render correctly. Be prepared to adjust Markdown source or Confluence post-conversion if specific formatting is critical. Use verbose logging (`-V` or `--verbose`) for diagnostics.
When publishing new hierarchies, ensure parent pages are established. For existing pages, consider adding explicit `confluence-page-id` comments to Markdown files for robust association. Verify parent-child relationships in Confluence.