Skip to content

Conversation

@FrankLedo
Copy link
Contributor

Summary

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

  • Added new rehype-replace-code-blocks plugin to transform <pre><code> elements to Confluence's code macro format
  • Added confluence.rehype.codeBlocks configuration option (default: true) to enable/disable the feature for compatibility with older Confluence versions
  • Comprehensive unit tests with 10 test cases covering various scenarios (empty blocks, multiple languages, special characters, etc.)
  • Updated documentation in README.md with configuration details and examples
  • Updated CHANGELOG.md under "unreleased" section
  • Bumped package version to 2.3.0 (MINOR version per semantic versioning)

Implementation Details

The plugin:

  • Converts markdown fenced code blocks to Confluence's <ac:structured-macro ac:name="code"> format
  • Preserves language syntax highlighting information from code fence language identifiers
  • Handles edge cases: empty blocks, blocks without language specification, special characters, multi-line code
  • Is enabled by default but can be disabled via configuration for older Confluence instances

Test Plan

  • All existing unit tests pass
  • New unit tests added and passing (10 comprehensive tests)
  • Linting checks pass
  • TypeScript compilation successful
  • Feature follows existing plugin patterns in the codebase

Closes #65

Implements proper rendering of markdown code blocks in Confluence by
converting them to structured code macros with syntax highlighting.
This addresses issue Telefonica#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.
@FrankLedo FrankLedo force-pushed the feat/65/code-blocks-confluence-macro branch from 44f9f5d to 9502952 Compare November 13, 2025 17:36
@github-actions
Copy link

github-actions bot commented Nov 13, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@FrankLedo
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@javierbrea
Copy link
Collaborator

Wow! Fantastic work, thank you so much for this contribution! 🙌

I really appreciate the thorough implementation and comprehensive test coverage. There are just two small details I'd like to suggest. I've left some detailed comments in the code review regarding the configuration structure and default values.

I'm happy to handle merging this into the release branch and exposing the new configuration option through the general configuration system. I won't ask you to do this part since the code for adding these options can be a bit tricky—and I don't think that's the best use of your time on a first contribution! 😊

…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]>
@FrankLedo FrankLedo requested a review from javierbrea November 14, 2025 17:17
@javierbrea javierbrea changed the base branch from release to feat/65/rehype-codeblocks November 17, 2025 07:19
@javierbrea
Copy link
Collaborator

Changing the base branch to feat/65/rehype-codeblocks to finish development there before adding it to the release branch.

@javierbrea javierbrea merged commit 7819627 into Telefonica:feat/65/rehype-codeblocks Nov 17, 2025
8 of 11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants