A CLI tool to convert Confluence pages to Markdown format with a single command. Supports images, tables, lists, and various macros (yes, even mermaid diagrams!).
- Convert single Confluence pages to Markdown
- Convert entire page trees with hierarchical structure
- Download and embed images from Confluence pages
- Support for Confluence Cloud with API authentication
- Enhanced support for Confluence-specific elements (user references, status badges, time elements)
- Clean, readable Markdown output
- Cross-platform support (Linux, macOS, Windows)
Download the latest release for your platform from the releases page.
go install github.com/jackchuka/confluence-md/cmd/confluence-md@latest
You'll need:
- Your Confluence email address
- A Confluence API token (create one here)
confluence-md page <page-url> --email your-email@example.com --api-token your-api-token
Example:
confluence-md page https://example.atlassian.net/wiki/spaces/SPACE/pages/12345/Title \
--email john.doe@company.com \
--api-token your-api-token-here
Convert an entire page hierarchy:
confluence-md tree <page-url> --email your-email@example.com --api-token your-api-token
Convert Confluence HTML directly without API access (useful for testing or working with exported HTML):
# Convert from file
confluence-md html page.html -o output.md
# Convert from stdin
cat page.html | confluence-md html -o output.md
# Output to stdout
confluence-md html page.html
--email, -e
: Your Confluence email address (required)--api-token, -t
: Your Confluence API token (required)--output, -o
: Output directory (default: current directory)--output-name-template
: Go template for the markdown filename (see below)--download-images
: Download images from Confluence (default: true)--image-folder
: Folder to save images (default:assets
)--include-metadata
: Include page metadata in the Markdown front matter (default: true)
# Convert to a specific directory
confluence-md page <page-url> --email user@example.com --api-token token --output ./docs
# Prefix filenames with the last updated date (YYYY-MM-DD-title.md)
confluence-md page <page-url> \
--email user@example.com \
--api-token token \
--output-name-template "{{ .Page.UpdatedAt.Format \"2006-01-02\" }}-{{ .SlugTitle }}"
# Convert without downloading images
confluence-md page <page-url> --email user@example.com --api-token token --download-images=false
# Convert entire page tree
confluence-md tree <page-url> --email user@example.com --api-token token --output ./wiki
The --output-name-template
flag accepts a Go text/template string. Templates can reference:
{{ .Page }}
β the full Confluence page object (e.g.{{ .Page.UpdatedAt.Format "2006-01-02" }}
){{ .Page.Title }}
β the original page title{{ .Page.ID }}
β the Confluence page ID{{ .Page.SpaceKey }}
β the Confluence space key- see ConfluencePage struct for more fields
{{ .SlugTitle }}
β the default slugified title (e.g.sample-page
)
Additionally, you can use the following helper functions:
{{ slug <string> }}
β slugifies a string (e.g.Sample Page
βsample-page
)
If the rendered filename omits an extension, .md
is appended automatically.
Element | Confluence Tag | Conversion |
---|---|---|
Images | ac:image |
Downloaded and converted to local markdown image references |
Emoticons | ac:emoticon |
Converted to emoji fallback or shortnames |
Tables | Standard HTML tables | Full table support with proper markdown formatting |
Lists | Standard HTML lists | Nested lists with proper indentation |
User Links | ac:link + ri:user |
Converted to @DisplayName (or @user(account-id) if name not cached) |
Time Elements | <time> |
Datetime attribute extracted and displayed |
Inline Comments | ac:inline-comment-marker |
Text preserved with comment reference |
Placeholders | ac:placeholder |
Converted to HTML comments |
Macro | Status | Conversion |
---|---|---|
info |
β Fully Supported | Converted to blockquote with βΉοΈ Info prefix |
warning |
β Fully Supported | Converted to blockquote with |
note |
β Fully Supported | Converted to blockquote with π Note prefix |
tip |
β Fully Supported | Converted to blockquote with π‘ Tip prefix |
code |
β Fully Supported | Converted to markdown code blocks with language syntax highlighting |
mermaid-cloud |
β Fully Supported | Converted to mermaid code blocks |
expand |
β Fully Supported | Content extracted and rendered directly |
details |
β Fully Supported | Content extracted and rendered directly |
status |
β Fully Supported | Converted to emoji badges (π΄ S1, π‘, π’, π΅, βͺ) |
toc |
Converted to <!-- Table of Contents --> comment |
|
children |
Converted to <!-- Child Pages --> comment |
|
Other macros | Plan to support per request | Converted to <!-- Unsupported macro: {name} --> comments |
User references (@user
) are automatically resolved to display names when converting pages via the page
or tree
commands
Note: When using the html
command (without Confluence API access), user names cannot be resolved and will always display as @user(account-id)
.
The tool creates:
- Markdown files (.md) for each page
- An
assets/
directory containing downloaded images - Hierarchical directory structure for page trees
- Go 1.24.4 or later
git clone https://github.com/jackchuka/confluence-md.git
cd confluence-md
go build -o confluence-md cmd/confluence-md/main.go
go test ./...
golangci-lint run
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run tests and linting
- Submit a pull request
For issues and feature requests, please use the GitHub issue tracker.