Skip to main content

Publish Markdown files to Confluence wiki

Project description

Publish Markdown files to Confluence wiki

Contributors to software projects typically write documentation in Markdown format and host Markdown files in collaborative version control systems (VCS) such as GitHub or GitLab to track changes and facilitate the review process. However, not everyone at a company has access to VCS, and documents are often circulated in Confluence wiki instead.

Replicating documentation to Confluence by hand is tedious, and a lack of automated synchronization with the project repositories where the documents live leads to outdated documentation.

This Python package

  • parses Markdown files,
  • converts Markdown content into the Confluence Storage Format (XHTML),
  • invokes Confluence API endpoints to upload images and content.

Features

  • Sections and subsections
  • Text with bold, italic, monospace, underline and strikethrough
  • Link to external locations
  • Ordered and unordered lists
  • Code blocks (e.g. Python, JSON, XML)
  • Image references (uploaded as Confluence page attachments)

Getting started

In order to get started, you will need

  • your organization URL (e.g. https://instructure.atlassian.net),
  • your Confluence username (e.g. levente.hunyadi@instructure.com),
  • a Confluence API token (a string of alphanumeric characters), and
  • the space key in Confluence (e.g. DAP) you are publishing content to.

Obtaining an API token

  1. Log in to https://id.atlassian.com/manage/api-tokens.
  2. Click Create API token.
  3. From the dialog that appears, enter a memorable and concise Label for your token and click Create.
  4. Click Copy to clipboard, then paste the token to your script, or elsewhere to save.

Setting up the environment

Confluence organization URL, username, API token and space key can be specified at runtime or set as Confluence environment variables (e.g. add to your ~/.profile on Linux, or ~/.bash_profile or ~/.zshenv on MacOS):

export CONFLUENCE_DOMAIN='instructure.atlassian.net'
export CONFLUENCE_USER_NAME='levente.hunyadi@instructure.com'
export CONFLUENCE_API_KEY='0123456789abcdef'
export CONFLUENCE_SPACE_KEY='DAP'

On Windows, these can be set via system properties.

The tool requires appropriate permissions in Confluence in order to invoke endpoints.

Associating a Markdown file with a wiki page

Each Markdown file is associated with a Confluence wiki page with a Markdown comment:

<!-- confluence-page-id: 85668266616 -->

The above tells the tool to synchronize the Markdown file with the given Confluence page ID. This implies that the Confluence wiki page must exist such that it has an ID. The comment can be placed anywhere in the source file.

Running the tool

You execute the command-line tool md2conf to synchronize the Markdown file with Confluence:

python3 -m md2conf example.md

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

markdown-to-confluence-0.1.4.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

markdown_to_confluence-0.1.4-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file markdown-to-confluence-0.1.4.tar.gz.

File metadata

  • Download URL: markdown-to-confluence-0.1.4.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for markdown-to-confluence-0.1.4.tar.gz
Algorithm Hash digest
SHA256 277f8848a2203804c11fd834ca7a8f55d743426282a4f45e034e6a9e25735a09
MD5 e0248edaa48fbc1c64c12b52f0dfb0e5
BLAKE2b-256 b788b3f5623a97d819489538ceff35ce4bc34d36d6973c3914072c21e312f28f

See more details on using hashes here.

File details

Details for the file markdown_to_confluence-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for markdown_to_confluence-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b04d4e150cd0af0d5b416f62338d0b14807e29a5a483df86dacf6592ed733a7d
MD5 9a53d6ea18408e0e16be21c429eb3865
BLAKE2b-256 ade0c99a01000698cdb960fe17809d11f67b0b317bfb3abef9e243c5dd5b69b9

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