ngx-admin/docs/app/@theme/services/highlight.service.ts

11 lines
258 B
TypeScript
Raw Normal View History

2019-07-16 08:38:11 +03:00
import { Injectable } from '@angular/core';
import * as hljs from 'highlight.js';
@Injectable()
export class NgxHighlightService {
public highlight(code: string): string {
return hljs.highlightAuto(code, ['ts', 'html', 'scss', 'nginx']).value;
}
}