PlantUML Diagram Export Feature #106
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PlantUML Diagram Export Feature
Summary
Successfully extended the Confluence Markdown Exporter to support exporting PlantUML diagrams from Confluence pages to Markdown code blocks.
Changes Made
1. Added Dependencies
pyproject.tomllxmlpackage to project dependencies for XML parsing supporteditor2XML format2. Core Implementation
confluence_markdown_exporter/confluence.pyjsonimport for parsing PlantUML data structuresconvert_plantuml()method in thePage.Converterclassplantumlhandler in the macro handlers dictionary3. Test Coverage
tests/unit/test_plantuml_conversion.py(new file)How It Works
Detection: When the exporter encounters a PlantUML macro in the Confluence HTML (identified by
data-macro-name="plantuml"), it triggers theconvert_plantuml()methodXML Parsing: The method parses the
editor2XML format to find the corresponding PlantUML macro using themacro-idattributeData Extraction: Extracts the PlantUML definition from the JSON structure stored in the CDATA section of the
<ac:plain-text-body>elementMarkdown Conversion: Converts the UML definition to a Markdown code block with
plantumlsyntax highlightingExample
Input (Confluence XML):
Output (Markdown):
Error Handling
The implementation includes robust error handling for:
All error cases result in HTML comments in the output, allowing the export to continue without failing.
Testing
All tests pass successfully: