Skip to content

feat(code-block): added highlight.js language provider (#DS-3178)#1593

Open
artembelik wants to merge 7 commits into
mainfrom
feat/DS-3178
Open

feat(code-block): added highlight.js language provider (#DS-3178)#1593
artembelik wants to merge 7 commits into
mainfrom
feat/DS-3178

Conversation

@artembelik
Copy link
Copy Markdown
Contributor

No description provided.

@artembelik artembelik self-assigned this May 21, 2026
Copilot AI review requested due to automatic review settings May 21, 2026 15:38
@artembelik artembelik requested a review from lskramarov as a code owner May 21, 2026 15:38
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 introduces an injectable highlight.js configuration for the code-block component so consumers can lazy-load the Highlight.js core and register only the languages they need (reducing bundle size), and updates docs/examples/tests accordingly.

Changes:

  • Added KBQ_CODE_BLOCK_HIGHLIGHT_JS_CONFIG, KbqCodeBlockHighlightJsConfig, and kbqCodeBlockHighlightJsConfigProvider to support async Highlight.js core/language loading.
  • Updated docs-examples and component docs (EN/RU) to demonstrate configuring Highlight.js with lazy-loaded core + languages.
  • Updated KbqCodeBlock tests to wait for async highlighting, and added tests for the async-loading path.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/public_api_guard/components/code-block.api.md Public API report updated for new Highlight.js config token/type/provider exports.
packages/components/code-block/code-block-highlight.ts Switched from eager Highlight.js import to async loader + DI-driven configuration and language registration.
packages/components/code-block/code-block.spec.ts Adjusted existing tests for async highlighting and added new async-core tests.
packages/components/code-block/code-block.en.md Documented Highlight.js configuration for smaller bundles.
packages/components/code-block/code-block.ru.md Documented Highlight.js configuration for smaller bundles (RU).
packages/docs-examples/components/code-block/code-block-overview/code-block-overview-example.ts Added Highlight.js config provider usage in docs example.
packages/docs-examples/components/code-block/code-block-header-pinned/code-block-header-pinned-example.ts Added Highlight.js config provider usage in docs example.
packages/docs-examples/components/code-block/code-block-with-custom-locale-configuration/code-block-with-custom-locale-configuration-example.ts Added Highlight.js config provider usage alongside locale override example.
packages/docs-examples/components/code-block/code-block-with-filled/code-block-with-filled-example.ts Added Highlight.js config provider usage in docs example.
packages/docs-examples/components/code-block/code-block-with-link/code-block-with-link-example.ts Added Highlight.js config provider usage in docs example.
packages/docs-examples/components/code-block/code-block-with-max-height/code-block-with-max-height-example.ts Added Highlight.js config provider usage in docs example.
packages/docs-examples/components/code-block/code-block-with-no-border/code-block-with-no-border-example.ts Added Highlight.js config provider usage in docs example.
packages/docs-examples/components/code-block/code-block-with-soft-wrap/code-block-with-soft-wrap-example.ts Added Highlight.js config provider usage in docs example.
packages/docs-examples/components/code-block/code-block-with-tabs/code-block-with-tabs-example.ts Added Highlight.js config provider usage in docs example.
packages/docs-examples/components/code-block/code-block-with-tabs-and-shadow/code-block-with-tabs-and-shadow-example.ts Added Highlight.js config provider usage in docs example.
packages/components-dev/code-block/module.ts Updated dev module wiring to import standalone examples directly (and removed app-level locale provider).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/components/code-block/code-block-highlight.ts
Comment thread packages/components/code-block/code-block-highlight.ts Outdated
Comment thread packages/components/code-block/code-block-highlight.ts
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

Visit the preview URL for this PR (updated for commit 4da1efe):

https://koobiq-next--prs-1593-t7efbyco.web.app

(expires Wed, 27 May 2026 11:48:58 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c

@github-actions
Copy link
Copy Markdown

🚨 E2E tests failed

Review the report for details.


💡 Comment /approve-snapshots to approve snapshot changes.

@github-actions
Copy link
Copy Markdown

🚨 E2E tests failed

Review the report for details.


💡 Comment /approve-snapshots to approve snapshot changes.

@github-actions
Copy link
Copy Markdown

🚨 E2E tests failed

Review the report for details.


💡 Comment /approve-snapshots to approve snapshot changes.

@github-actions
Copy link
Copy Markdown

🚨 E2E tests failed

Review the report for details.


💡 Comment /approve-snapshots to approve snapshot changes.

@github-actions
Copy link
Copy Markdown

🚨 E2E tests failed

Review the report for details.


💡 Comment /approve-snapshots to approve snapshot changes.

@artembelik artembelik marked this pull request as draft May 22, 2026 11:09
@github-actions
Copy link
Copy Markdown

🚨 E2E tests failed

Review the report for details.


💡 Comment /approve-snapshots to approve snapshot changes.

@artembelik
Copy link
Copy Markdown
Contributor Author

/approve-snapshots

@github-actions
Copy link
Copy Markdown

🔄 Updating snapshots.

@github-actions
Copy link
Copy Markdown

✅ Snapshots updated!

@artembelik artembelik marked this pull request as ready for review May 22, 2026 11:51
@artembelik artembelik requested a review from NikGurev May 22, 2026 13:09
Comment thread packages/components/code-block/code-block.ts
FormsModule
],
providers: [
kbqCodeBlockHighlightJsConfigProvider({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предлагаю в overview-примере не делать настройку, пусть он будет минимален и демонстрирует дефолтный вариант. Что думаешь?

<pre
class="kbq-code-block__pre"
><code kbqCodeBlockHighlight class="kbq-code-block__code" [file]="file"></code></pre>
><code kbqCodeBlockHighlight class="kbq-code-block__code" [file]="file">{{ file.content }}</code></pre>
Copy link
Copy Markdown
Contributor

@NikGurev NikGurev May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На что это влияет? Внутри вроде все равно меняется на <table class="hljs-ln">?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants