marked#setOptions TypeScript Examples

The following examples show how to use marked#setOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: lsp-hover.tsx    From uivonim with GNU Affero General Public License v3.0 6 votes vote down vote up
setOptions({
  highlight: (code, lang, _) => {
    const hljs = require('highlight.js/lib/core')
    hljs.registerLanguage(
      lang,
      require(`highlight.js/lib/languages/${lang}.js`)
    )

    const highlightedCode = hljs.highlight(code, { language: lang }).value
    return highlightedCode
  },
})