fix: Improve CodeGroupExtension with better language parsing and attribute preservation#9
Open
dereuromark wants to merge 1 commit intojosbeir:mainfrom
Open
Conversation
…ibute preservation This PR improves the CodeGroupExtension with changes aligned with djot-php's upstream CodeGroupExtension implementation: **Bug fixes:** - Language regex now supports special characters (c++, c#, text/html, etc.) - Old regex: `/[A-Za-z0-9_-]+/` - only alphanumeric - New regex: `/[^\s\[]+/` - any non-whitespace chars **New features:** - Attribute preservation: custom id, classes, and data-* attributes from the div are now preserved in the rendered output - Multiple custom classes are merged with glaze-code-group class **Requires:** php-collective/djot ^0.1.21 for attribute preservation to work (contains fix for class merging in fenced divs) Aligned with: php-collective/djot-php#132
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR improves the
CodeGroupExtensionwith changes aligned with djot-php's upstream implementation.Bug Fixes
/[A-Za-z0-9_-]+/- only alphanumeric, underscore, dash/[^\s\[]+/- any non-whitespace charactersNew Features
id, classes, anddata-*attributes from the div are now preserved in the rendered outputglaze-code-groupclassExample
:::
Dependencies
Requires:
php-collective/djot ^0.1.21for attribute preservation to work (contains fix for class merging in fenced divs - php-collective/djot-php#137)Related