ngx-highlightjs
Version:
Instant code highlighting, auto-detect language, super easy to use.
32 lines (31 loc) • 1.67 kB
TypeScript
import { EventEmitter, OnChanges, SimpleChanges, ElementRef } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { HighlightJS } from './highlight.service';
import { HighlightOptions, HighlightAutoResult } from './highlight.model';
import * as i0 from "@angular/core";
export declare class Highlight implements OnChanges {
private _hljs;
private _sanitizer;
private _options;
private readonly _nativeElement;
private _lineNumbersObs;
code: string | null;
languages: string[];
lineNumbers: boolean;
highlighted: EventEmitter<HighlightAutoResult>;
constructor(el: ElementRef, _hljs: HighlightJS, _sanitizer: DomSanitizer, _options: HighlightOptions);
ngOnChanges(changes: SimpleChanges): void;
/**
* Highlighting with language detection and fix markup.
* @param code Accepts a string with the code to highlight
* @param languages An optional array of language names and aliases restricting detection to only those languages.
* The subset can also be set with configure, but the local parameter overrides the option if set.
*/
highlightElement(code: string, languages: string[]): void;
private addLineNumbers;
private destroyLineNumbersObserver;
private setTextContent;
private setInnerHTML;
static ɵfac: i0.ɵɵFactoryDeclaration<Highlight, [null, null, null, { optional: true; }]>;
static ɵdir: i0.ɵɵDirectiveDeclaration<Highlight, "[highlight]", never, { "code": "highlight"; "languages": "languages"; "lineNumbers": "lineNumbers"; }, { "highlighted": "highlighted"; }, never, never, false>;
}