UNPKG

@ng-doc/app

Version:

<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>

47 lines (43 loc) 1.77 kB
import * as i0 from '@angular/core'; import { inject, Injectable } from '@angular/core'; import { NG_DOC_SHIKI_THEME } from '@ng-doc/app/tokens'; import { createHighlighterCore } from 'shiki/core'; import getWasm from 'shiki/wasm'; class NgDocHighlighterService { constructor() { this.theme = inject(NG_DOC_SHIKI_THEME); } async initialize(config) { this.highlighter = (await createHighlighterCore({ themes: [ import('shiki/themes/github-light.mjs'), import('shiki/themes/ayu-dark.mjs'), ...(config?.themes ?? []), ], langs: [import('shiki/langs/angular-html.mjs')], loadWasm: getWasm, })); } highlight(code) { return this.highlighter.codeToHtml(code, { lang: 'angular-html', themes: { light: this.theme.light || 'github-light', dark: this.theme.dark || 'ayu-dark', }, }); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgDocHighlighterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgDocHighlighterService, providedIn: 'root' }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgDocHighlighterService, decorators: [{ type: Injectable, args: [{ providedIn: 'root', }] }] }); /** * Generated bundle index. Do not edit. */ export { NgDocHighlighterService }; //# sourceMappingURL=ng-doc-app-services-highlighter.mjs.map