goessner/markdown-it-texmath

Need Loader to Handle file type

Closed this issue · 1 comments

Here is my code:

  // init the markdown object (with code highlight)
  var md = require('markdown-it')({
    highlight: (str, lang) => {
      if (lang && highlight.getLanguage(lang)) {
        try {
          return highlight.highlight(lang, str).value
        } catch (__) {
          // ...
        }
      }
      return ''
    }
  }).use(markdownTexmath, {
    engine: require('katex'),
    delimiters:'dollars',
    katexOptions: {macros: {"\RR": "\mathbb{R}"}}
  })

But it raise a error like:

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

Which loader should I install?

hmm ... you need to require markdownTexmath properly above ...

const markdownTexmath = require("texmath.js");

You are dealing here with markdown-it stuff ... see

https://markdown-it.github.io/markdown-it/#MarkdownIt.use

for more info ...