Skip to content

Latest commit

 

History

History
84 lines (61 loc) · 2.8 KB

File metadata and controls

84 lines (61 loc) · 2.8 KB

MCP Jira Confluence v0.2.1 - Formatting Fix Summary

Issue Resolved ✅

Problem: Confluence page creation was failing with 400 Bad Request errors when using heavy markdown formatting, while simple content worked fine.

Root Cause: The markdown-to-Confluence converter was generating malformed or overly complex XHTML that Confluence's REST API rejected.

Solutions Implemented

1. Intelligent Complexity Detection

  • Added regex-based markdown complexity analysis
  • Automatically switches between detailed and simplified conversion strategies
  • Detects patterns: headers, bold/italic, code, lists, links, images

2. Robust Formatter Architecture

# Two-tier conversion approach:
- _detailed_markdown_to_confluence() # For simple content
- _simple_markdown_to_confluence()   # For complex content

3. Improved Error Handling

  • Added try-catch blocks around conversion logic
  • Fallback to simple HTML paragraph wrapping on conversion failures
  • Comprehensive logging for debugging

4. Better List Processing

  • Line-by-line processing instead of regex-heavy approach
  • Proper list grouping (<ul> wrapping multiple <li> elements)
  • Correct list closure handling

5. Enhanced Inline Formatting

  • Improved bold/italic regex to avoid conflicts
  • Protected inline code from other conversions
  • Better link and image handling

Test Results ✅

Simple Content: ✅ Perfect formatting with full feature support Complex Content: ✅ Graceful degradation with clean HTML output Error Handling: ✅ Fallback mechanisms prevent failures HTML Passthrough: ✅ Existing HTML preserved correctly

Key Improvements

Feature Before After
Complex Markdown ❌ 400 Error ✅ Clean HTML
List Formatting ⚠️ Malformed ✅ Proper nesting
Error Recovery ❌ Total failure ✅ Graceful fallback
Code Blocks ⚠️ Complex macros ✅ Simple <pre> tags
Detection Logic ⚠️ Basic string matching ✅ Regex pattern analysis

Version History

  • v0.1.9: Initial release with basic functionality
  • v0.2.0: Major formatting improvements and error handling
  • v0.2.1: Enhanced robustness and fallback mechanisms

Usage Recommendation

The formatter now automatically handles complexity:

  • Simple markdown → Full featured conversion with Confluence macros
  • Complex markdown → Simplified but reliable HTML conversion
  • HTML content → Unchanged passthrough
  • Plain text → Wrapped in paragraph tags

Users no longer need to worry about formatting complexity causing 400 errors!

Testing

Run the test suite to verify all improvements:

python test_v0_2_0.py

Published to PyPI ✅

Version 0.2.1 is now available:

pip install mcp-jira-confluence==0.2.1