[#132] Add Highlight.js syntax highlighter#137
[#132] Add Highlight.js syntax highlighter#137StevenWalker98 wants to merge 2 commits intodrevops:developfrom
Conversation
- Added drupal/highlight_js ^1.2 to composer.json - Enabled highlight_js module in core.extension - Added highlight_js.settings.yml with GitHub theme - Added highlight_js filter to civictheme_rich_text format - Added <highlight-js> to allowed HTML tags - Added highlightJs toolbar button to CKEditor config - Added highlight_js module dependency to editor config Note: composer.lock needs to be updated by running composer update drupal/highlight_js in an environment with SSH access to private repos.
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds the Drupal highlight_js module as a dependency to enable source code syntax highlighting. Updates Composer configuration, registers the module in core extensions, and configures editor toolbar integration and filter settings with styling options. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@composer.json`:
- Line 31: composer.json added the dependency "drupal/highlight_js": "^1.2" but
composer.lock was not updated, breaking CI; run Composer locally (for example:
composer require drupal/highlight_js:^1.2 or composer update drupal/highlight_js
--with-dependencies) to regenerate composer.lock, verify the lock now contains
drupal/highlight_js@1.2.x, then commit and push the updated composer.lock
alongside the composer.json change so the CI can pass.
In `@config/default/filter.format.civictheme_rich_text.yml`:
- Line 56: Replace the malformed empty-mapping syntax in
filter.format.civictheme_rich_text.yml: change the line "settings: { }" to use
a compact empty mapping "settings: {}" (no spaces inside braces) so it matches
YAMLlint rules and the style used in highlight_js.settings.yml.
In `@config/default/highlight_js.settings.yml`:
- Around line 8-9: Replace the invalid empty-brace formatting for the YAML keys
role_copy_access and languages by changing their values from "{ }" to "{}" so
they are valid empty mappings for YAMLlint; update both occurrences
(role_copy_access: { } -> role_copy_access: {} and languages: { } ->
languages: {}) and ensure no trailing spaces remain inside the braces.
| provider: highlight_js | ||
| status: true | ||
| weight: -40 | ||
| settings: { } |
There was a problem hiding this comment.
Fix YAML empty-brace formatting (YAMLlint error)
settings: { } uses spaces inside the empty mapping braces, matching the same YAMLlint violation as in highlight_js.settings.yml.
🛠️ Proposed fix
- settings: { }
+ settings: {}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| settings: { } | |
| settings: {} |
🧰 Tools
🪛 YAMLlint (1.38.0)
[error] 56-56: too many spaces inside empty braces
(braces)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@config/default/filter.format.civictheme_rich_text.yml` at line 56, Replace
the malformed empty-mapping syntax in filter.format.civictheme_rich_text.yml:
change the line "settings: { }" to use a compact empty mapping "settings: {}"
(no spaces inside braces) so it matches YAMLlint rules and the style used in
highlight_js.settings.yml.
| role_copy_access: { } | ||
| languages: { } |
There was a problem hiding this comment.
Fix YAML empty-brace formatting (YAMLlint error)
Both role_copy_access and languages use { } (spaces inside braces), which fails YAMLlint. Use {} to represent empty mappings.
🛠️ Proposed fix
-role_copy_access: { }
-languages: { }
+role_copy_access: {}
+languages: {}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| role_copy_access: { } | |
| languages: { } | |
| role_copy_access: {} | |
| languages: {} |
🧰 Tools
🪛 YAMLlint (1.38.0)
[error] 8-8: too many spaces inside empty braces
(braces)
[error] 9-9: too many spaces inside empty braces
(braces)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@config/default/highlight_js.settings.yml` around lines 8 - 9, Replace the
invalid empty-brace formatting for the YAML keys role_copy_access and languages
by changing their values from "{ }" to "{}" so they are valid empty mappings
for YAMLlint; update both occurrences (role_copy_access: { } ->
role_copy_access: {} and languages: { } -> languages: {}) and ensure no
trailing spaces remain inside the braces.
Closes #132
Changes
Adds the Highlight.js module for source code syntax highlighting in CKEditor 5.
drupal/highlight_js^1.2 tocomposer.jsoncore.extension.ymlhighlight_js.settings.yml— GitHub theme, copy button enabledcivictheme_rich_texttext format:highlight_jsfilter<highlight-js>to allowed HTML tagshighlightJstoolbar buttonhighlight_jsmodule dependencyNote
composer.lockneeds updating — could not runcomposer updatelocally due to SSH access issue withdrevops/test-private-package. This will need to be resolved in CI or by someone with the private repo access.Theme
Set to
github— clean and professional. Can be changed at/admin/config/content/highlight-js.Summary by CodeRabbit