Skip to content

3.0版本urlLoaderExcludes被删除, 使用markdown-loader 多了许多‘’/n‘’回车符 #6519

Discussion options

You must be logged in to vote

哈哈解决了,
umi3应该使用的是资源模块 type: 'asset/source' 所以去掉loader('html-loader') 就可以了
如下配置

config.module
      .rule('markdown')
      .test(/\.md$/)
      .exclude.add([
        path.resolve('../src/pages/.umi'),
        path.resolve('node_modules'),
      ])
      .end()
      .use('markdown-loader')
      .loader('markdown-loader')
      .options({
        highlight(code, lang) {
          const language = hljs.getLanguage(lang) ? lang : 'plaintext';
          return hljs.highlight(code, { language }).value;
        },
      });

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by huangpiaofighting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant