Skip to content
@ng-doc/app / Class

NgDocHighlighterService

Highlights code with Shiki. provideNgDocApp initializes it before the application renders.

Decorators
@Service
Implements
OnDestroy
DeclarationTypeScript
@Service()
export class NgDocHighlighterService implements OnDestroy { … }

Members

Properties

2
ready: Signal<boolean>
readonly

Whether highlight() can highlight: true once initialize() has finished, and false again after the service is destroyed.

protectedreadonly
—

Methods

3
(…): string

Returns the code as highlighted HTML, or an empty string before initialize() has finished. It reads ready(), so a computed over it updates once Shiki is loaded.

(…): Promise<void>

Loads Shiki with the built-in themes (github-light, ayu-dark and NgDoc's css-variables) and the given ones. Concurrent and repeated calls share one initialization; a failed one can be retried.

(): void
implements OnDestroy

Disposes the highlighter this service created for custom themes.

Symbol
Kind
Class
Decorators
@Service
Implements
OnDestroy
Scope
@ng-doc/app
Edit this page