Push locally edited markdown (exported with confluence-markdown-exporter) back to Confluence
Project description
confluence-markdown-importer
Push locally edited markdown back to Confluence. The counterpart of
confluence-markdown-exporter (cme):
you export a space to a git repository with cme, edit the markdown locally (for example with an
AI coding agent, reviewed in a git branch), and then update the Confluence pages with cmi.
How it works
- Shared configuration.
cmireads the same config file ascme(includingCME_CONFIG_PATHandCME_*environment overrides). Ifcmeis already set up, no extra credential setup is needed. To configure credentials, runcme config edit auth.confluence. - Shared page mapping. The exporter's
confluence-lock.jsonmaps local files to Confluence pages (page id, space, version).cminever writes that file. - Own baseline state.
cmi baselinerecords a sha256 hash of every tracked file inconfluence-import-state.jsonnext to the lockfile.cmi importpushes only files whose hash changed since the baseline. Commit this file to git together withconfluence-lock.jsonso the baseline travels with the repository and every collaborator compares against the same clean state. - Conflict protection. Before updating a page,
cmicompares the current Confluence version with the baseline version. If someone changed the page in Confluence since your export, the page is skipped and reported (override with--force).
Workflow
# 1. Export (cme) and snapshot the baseline (cmi)
cme space https://company.atlassian.net/wiki/spaces/KEY
cmi baseline
git add -A && git commit -m "docs: sync from Confluence"
# 2. Edit markdown locally, review in a branch
# 3. Preview and push
cmi import --dry-run
cmi import
# 4. Re-export to normalize local files to Confluence's canonical rendering,
# then snapshot the new baseline
cme space https://company.atlassian.net/wiki/spaces/KEY
cmi baseline
Both commands take the export root directory as an optional argument (default: current directory).
Commands
| Command | Purpose |
|---|---|
cmi baseline [DIR] |
Record the current files as the clean baseline. Run right after each export. |
cmi import [DIR] --dry-run |
Show what would be pushed, including conversion warnings. Read-only. |
cmi import [DIR] |
Update changed pages in Confluence. |
cmi import [DIR] --force |
Also push pages that changed in Confluence since the baseline. |
What gets converted
Exported markdown is converted back to Confluence storage format:
- Headings, paragraphs, emphasis, lists, tables, blockquotes.
- Fenced code blocks → Confluence code macro (with language).
- GitHub alerts (
> [!NOTE]etc.) → Confluence panel macros (exact inverse of the exporter's mapping). - Relative links to exported
.mdfiles → Confluence page links (resolved through the lockfile). - Attachment images →
ri:attachmentreferences (filenames resolved through the Confluence API). <mark>/<font>spans → Confluence highlight / color spans.- The YAML frontmatter, breadcrumb line, and H1 title added by the exporter are stripped
(honoring the corresponding
cmeexport settings).
Every generated page body is validated as well-formed XML before it is sent.
Scope and limitations (v1)
- Update existing pages only. New local files, locally deleted files, and files without a baseline are reported but not synced.
- No title renames. The exported H1 can be a lossy rendering of the real page title, so
cmikeeps the Confluence title and warns when the H1 differs. - Lossy for dynamic macros. The exporter renders macros (include, page properties reports, TOC, Jira links) into static markdown. Importing such a page replaces the live macro with that static rendering. Pages with plain text, tables, code, alerts, and links round-trip cleanly.
- Unresolvable links degrade to text. Links to pages outside the exported space (not in the lockfile) and links to local attachment files are kept as plain text and reported as warnings.
- Requires relative href exports.
cmi importrefuses to run when the cme config usesexport.page_hreforexport.attachment_hrefother thanrelative(the default), because absolute and wiki-style links cannot be converted back. - No attachment upload and no comment sync.
Development
make setup # create the environment (uv)
make test # pytest
make lint # ruff + mypy
make format # autoformat
make build # build wheel/sdist
License
MIT
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
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 confluence_markdown_importer-0.1.0.tar.gz.
File metadata
- Download URL: confluence_markdown_importer-0.1.0.tar.gz
- Upload date:
- Size: 76.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecb8439850339652ef8e9fe17bb0f74113e523df413328d6b230ef12031044aa
|
|
| MD5 |
5218a8ae76f51772d9f7fa99b563671c
|
|
| BLAKE2b-256 |
2ca73ce3de494a738e626248dd385091de6f929ece0849e616adc31c1197f2d0
|
Provenance
The following attestation bundles were made for confluence_markdown_importer-0.1.0.tar.gz:
Publisher:
publish.yml on stn1slv/confluence-markdown-importer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
confluence_markdown_importer-0.1.0.tar.gz -
Subject digest:
ecb8439850339652ef8e9fe17bb0f74113e523df413328d6b230ef12031044aa - Sigstore transparency entry: 2128024283
- Sigstore integration time:
-
Permalink:
stn1slv/confluence-markdown-importer@e2c08d35748aa967a7e04c4cb27ec65cabecd274 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/stn1slv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e2c08d35748aa967a7e04c4cb27ec65cabecd274 -
Trigger Event:
release
-
Statement type:
File details
Details for the file confluence_markdown_importer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: confluence_markdown_importer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
822eef3c0846d6ab4f1823cff2d0d16e1b891913dcda9418209fd01b977e0532
|
|
| MD5 |
4eb0765fbbb12b7921e5aaf8bb2eac1d
|
|
| BLAKE2b-256 |
2b29b6c3d384519d6bfb46a762d076b936fc92f1bc95a636b671b60c76867f70
|
Provenance
The following attestation bundles were made for confluence_markdown_importer-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on stn1slv/confluence-markdown-importer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
confluence_markdown_importer-0.1.0-py3-none-any.whl -
Subject digest:
822eef3c0846d6ab4f1823cff2d0d16e1b891913dcda9418209fd01b977e0532 - Sigstore transparency entry: 2128024365
- Sigstore integration time:
-
Permalink:
stn1slv/confluence-markdown-importer@e2c08d35748aa967a7e04c4cb27ec65cabecd274 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/stn1slv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e2c08d35748aa967a7e04c4cb27ec65cabecd274 -
Trigger Event:
release
-
Statement type: