This script converts Markdown files to Confluence pages and uploads them to a specified Confluence space. It also handles image uploads and converts Markdown links and headings to Confluence format.
- Converts Markdown files to Confluence pages.
- Handles image uploads.
- Converts Markdown links and headings to Confluence format.
- Supports nested folders by creating parent pages for each folder.
- Takes #tags and adds as confluence labels.
- Python 3.x
- requestslibrary
- python-dotenvlibrary
- 
Clone the repository: git clone https://github.com/DipFlip/markdown-to-confluence.git cd markdown-to-confluence
- 
Install the required Python libraries: pip install -r requirements.txt 
- 
Create a .envfile in the root directory of the project and modify the following environment variables. WhenCONFLUENCE_TOKENis given,CONFLUENCE_USERNAMEandCONFLUENCE_PASSWORDare ignored.BASE_URL=http://localhost:8090 CONFLUENCE_USERNAME=your_username CONFLUENCE_PASSWORD=your_password CONFLUENCE_TOKEN=your_personal_access_token SPACE_KEY=NAMEOFSPACE BASE_DIR=/abssolute/path/to/your/wiki/content IMAGE_DIR=relative/from/base_dir/to/image/dir An example is given with .env.example. You can copy it and start from there:cp .env.example .env 
- 
Ensure your Confluence instance is running and accessible at the BASE_URLspecified in the.envfile.
- 
To convert and upload all Markdown files in the specified BASE_DIR, run:python markdown-to-confluence.py 
- 
To convert and upload a specific Markdown file, provide the relative path to the file as an argument: python markdown-to-confluence.py path/to/your/file.md 
- The script will create parent pages for each folder in the BASE_DIRand add the Markdown files as child pages.
- The script removes YAML front matter and lines containing --------------TAGS-----------------from the Markdown files before conversion.
- Ensure that the BASE_DIRandIMAGE_DIRpaths in the.envfile are correct and accessible.
Feel free to submit issues or pull requests if you have any improvements or bug fixes.
This project is licensed under the MIT License.