Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ottolote committed May 2, 2024
1 parent e99143d commit 8b1553b
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
# markdown2confluence

Convert your Markdown files into Confluence pages with ease using the `markdown2confluence` script. It uploads all files from a specified Markdown directory to a Confluence space, maintaining the folder hierarchy as page structure.
Convert your Markdown files into Confluence pages with ease using the `markdown2confluence` script. It uploads all files from a specified Markdown directory to a Confluence space, applying a specific page label and maintaining the folder hierarchy as page structure.

## Prerequisites

Before you get started, locate the space ID and page ID in your Confluence URL by navigating to the desired space and page in your web browser.
Before you get started, you will need the space ID of your Confluence space and the ID of the parent page where you want to create new pages.

## Configuration

Set the following environment variables in your environment before running the script:
Configure your environment with the following variables before running the script:

- `CONFLUENCE_URL`: The URL to your Confluence instance's API endpoint, e.g., `https://your-instance.atlassian.net/wiki/rest/api/`
- `CONFLUENCE_URL`: Your Confluence instance's API endpoint, e.g., `https://your-instance.atlassian.net/wiki/rest/api/`
- `CONFLUENCE_USERNAME`: Your Confluence username
- `CONFLUENCE_PASSWORD`: Your Confluence password or API token
- `CONFLUENCE_SPACE`: The ID of the space in Confluence where the pages will be created
- `CONFLUENCE_PARENT_PAGE_ID`: The ID of the parent page under which the new pages will be created
- `MARKDOWN_FOLDER`: The path to your folder containing markdown files INSIDE the container, e.g. /data
- `CONFLUENCE_SPACE_ID`: The key of the Confluence space where the pages will be created
- `CONFLUENCE_PARENT_PAGE_ID`: The ID of the parent Confluence page under which new pages will be created
- `MARKDOWN_FOLDER`: The path to the folder containing markdown files
- `MARKDOWN_SOURCE_REF`: The url of the markdown source, e.g. and url to your repo
- `CONFLUENCE_PAGE_LABEL`: A label to apply to the Confluence pages to manage them as a group

## Example usage
Optionally, you can also set:
- `CONFLUENCE_PAGE_TITLE_SUFFIX`: A suffix to append to the title of Confluence pages, e.g., '(autogenerated)'
- `CONFLUENCE_IGNOREFILE`: Path to a file containing patterns to ignore when publishing

To upload sample markdown files to Confluence, ensure you have a `.env` file containing necessary key=value pairs for configuration. Then, run the following Docker command:
## Usage

To upload sample markdown files to Confluence, run the following Docker command, replacing `VAR1`, `VAR2`, etc., with your Confluence configuration values:

```bash
# Run from the root of this repo
docker run --rm --env-file=.env -v $(pwd)/markdownsample:/data ghcr.io/innofactororg/markdown2confluence:0.1.0-alpha
docker run --rm \
-e CONFLUENCE_URL=your_confluence_url \
-e CONFLUENCE_USERNAME=your_username \
-e CONFLUENCE_PASSWORD=your_password \
-e CONFLUENCE_SPACE_ID=your_space_id \
-e CONFLUENCE_PARENT_PAGE_ID=your_parent_page_id \
-e MARKDOWN_FOLDER=/data \
-e MARKDOWN_SOURCE_REF=your_source_ref \
-e CONFLUENCE_PAGE_TITLE_SUFFIX='(autogenerated)' \
-e CONFLUENCE_PAGE_LABEL=your_label \
-e CONFLUENCE_IGNOREFILE=your_ignorefile \
-v $(pwd)/yourlocalmarkdownfolder:/data \
--workdir=/data \
ghcr.io/innofactororg/markdown2confluence:latest
```

This command will start a Docker container, which reads your `.env` file (containing the required environment variable settings), and synchronizes the contents of your local Markdown folder with your Confluence space.

This command will start a Docker container, which uses the provided environment variables to synchronize the contents of your local Markdown folder with your Confluence space, applying the configured page title suffix and label.

0 comments on commit 8b1553b

Please sign in to comment.