-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add code blocks transformation to Confluence code macro #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implements proper rendering of markdown code blocks in Confluence by converting them to structured code macros with syntax highlighting. This addresses issue #65 where code blocks were appearing as inline text instead of formatted code blocks. The feature is enabled by default and can be disabled for compatibility with older Confluence versions via the confluence.rehype.codeBlocks configuration option.
…alse - Move codeBlocks from confluence.rehype.codeBlocks to top-level configuration - Change default value from true to false for backward compatibility - Update documentation to reflect new configuration structure This addresses PR feedback to align configuration structure with architectural boundaries and ensure backward compatibility with older Confluence versions that don't support code macros through the API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…macro feat: Add code blocks transformation to Confluence code macro
|
Check SPDX headers ✅ 247 files have valid headers. |
|
Check License Compliance ✅ There are 1450 dependencies with allowed licenses.
✅ Result: Valid licenses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for transforming markdown code blocks into Confluence's structured code macro format with syntax highlighting. The feature is disabled by default for backward compatibility with older Confluence versions and can be enabled via the rehype.codeBlocks configuration option.
Key Changes:
- Added
rehype-replace-code-blocksplugin to convert<pre><code>elements to Confluence code macros - Added
rehype.codeBlocksconfiguration option (default:false) - Comprehensive test suite with 10 test cases covering various scenarios
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| rehype-replace-code-blocks.test.ts | Comprehensive unit tests for the new code blocks transformation plugin |
| ConfluencePageTransformer.test.ts | Updated existing tests to include the new rehype configuration |
| ConfluenceSync.test.ts | Added rehype config namespace to test setup |
| rehype-replace-code-blocks.ts | Core plugin implementation for transforming code blocks |
| ConfluencePageTransformer.types.ts | Added type definitions for rehype options |
| ConfluencePageTransformer.ts | Integrated the code blocks plugin with conditional enabling |
| ConfluenceSync.types.ts | Added type definitions for the rehype codeBlocks option |
| ConfluenceSync.ts | Implemented the codeBlocks option and passed it to transformer |
| MarkdownConfluenceSync.ts | Added rehype configuration namespace |
| package.json | Version bump to 2.3.0 |
| markdown-confluence-sync.config.cjs | Example configuration with codeBlocks enabled |
| README.md | Documentation for the new feature |
| CHANGELOG.md | Release notes for version 2.3.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...s/markdown-confluence-sync/src/lib/confluence/transformer/ConfluencePageTransformer.types.ts
Show resolved
Hide resolved
...s/markdown-confluence-sync/src/lib/confluence/transformer/ConfluencePageTransformer.types.ts
Outdated
Show resolved
Hide resolved
components/markdown-confluence-sync/src/lib/confluence/ConfluenceSync.ts
Show resolved
Hide resolved
...-confluence-sync/src/lib/confluence/transformer/support/rehype/rehype-replace-code-blocks.ts
Show resolved
Hide resolved
…rmer/ConfluencePageTransformer.types.ts Co-authored-by: Copilot <[email protected]>
Add code blocks transformation to Confluence code macro
Description
Implements proper rendering of markdown code blocks in Confluence by converting them to structured code macros with syntax highlighting support. This addresses issue #65 where code blocks were appearing as inline text instead of formatted code blocks.
Changes
rehype-replace-code-blocksplugin to transform<pre><code>elements to Confluence's code macro formatrehype.codeBlocksconfiguration option (default:false) to enable/disable the feature for compatibility with older Confluence versionsImplementation Details
The plugin:
<ac:structured-macro ac:name="code">formatTest Plan
Closes #65
Agreement
Please check the following boxes after you have read and understood each item.
In case this is your first contribution to this project, you will also have to add a comment with the following text: "I have read the CLA Document and I hereby sign the CLA", otherwise the PR status will fail and our bot will request you to add it. Once you have signed it in a PR, you will not have to sign it again for future contributions.