goessner / markdown-it-texmath

Support TeX math equations with your Markdown documents.
MIT License
161 stars 29 forks source link

Need Loader to Handle file type #24

Closed PeterlitsZo closed 3 years ago

PeterlitsZo commented 3 years ago

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?

goessner commented 3 years ago

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 ...