(private readonly options: IMarkdownOptions)
| 7 | private readonly md: Remarkable; |
| 8 | |
| 9 | constructor(private readonly options: IMarkdownOptions) { |
| 10 | this.md = new Remarkable({ |
| 11 | highlight: (str: string, lang: string) => { |
| 12 | if (Markdown.hljs) { |
| 13 | if (lang && Markdown.hljs.getLanguage(lang)) { |
| 14 | try { |
| 15 | return Markdown.hljs.highlight(lang, str).value; |
| 16 | } catch (err) {} |
| 17 | } |
| 18 | |
| 19 | try { |
| 20 | return Markdown.hljs.highlightAuto(str).value; |
| 21 | } catch (err) {} |
| 22 | } else { |
| 23 | Markdown.loadhljs(); |
| 24 | } |
| 25 | return ''; |
| 26 | }, |
| 27 | ...objPropsToCamel(this.options) |
| 28 | }); |
| 29 | } |
| 30 | |
| 31 | public render = (value: string) => this.md.render(value); |
| 32 |
nothing calls this directly
no test coverage detected