Coder Social home page Coder Social logo

Comments (8)

QingWei-Li avatar QingWei-Li commented on June 15, 2024 1

vue-loader 15 的逻辑重构了,不过用下面的用法兼容

const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
    entry: './index.js',
    output: {
        filename: 'out.js'
    },
    module: {
        rules: [
            {
                test: /\.vue$/,
                loader: 'vue-loader'
            },
			// 👇
            {
                test: /\.md$/,
                loaders: ['vue-loader', 'vue-markdown-loader/lib/markdown-compiler.js']
            }
			// 👆
        ]
    },
    plugins: [
        new VueLoaderPlugin()
    ]
}

调整下,应该是下面这样

{
test: /\.md$/,
    use: [
        {
            loader: 'vue-loader'
        },
        {
            loader: 'vue-markdown-loader/lib/markdown-compiler',
            options: {
                raw: true
            }
        }
    ]
}

from vue-markdown-loader.

Lemenxzy avatar Lemenxzy commented on June 15, 2024 1

可是这样的话。vue-markdown-loader 的 options 怎么设置

from vue-markdown-loader.

samchen08 avatar samchen08 commented on June 15, 2024

看来要大神来解决下了

from vue-markdown-loader.

imcamo avatar imcamo commented on June 15, 2024

看来这个包已经放弃维护了

from vue-markdown-loader.

zdliuccit avatar zdliuccit commented on June 15, 2024

放弃维护了么

from vue-markdown-loader.

myronliu347 avatar myronliu347 commented on June 15, 2024

希望能给出解决方案, 想用vue-cli 3.0的版本创建项目

from vue-markdown-loader.

imcamo avatar imcamo commented on June 15, 2024

使用 vue-md-loader 吧

from vue-markdown-loader.

EPSON-LEE avatar EPSON-LEE commented on June 15, 2024

可是这样的话。vue-markdown-loader 的 options 怎么设置

{
        test: /\.md$/,
        use: [
          {
            loader: 'vue-loader'
          },
          {
            loader: 'vue-markdown-loader/lib/markdown-compiler',
            options: {
              raw: true,
              preventExtract: true,
              use: [
                [
                  require('markdown-it-container'),
                  'demo',
                  {
                    validate: function(params) {
                      return params.trim().match(/^demo\s+(.*)$/)
                    },

                    render: function(tokens, idx) {
                      if (tokens[idx].nesting === 1) {
                        // 1.获取第一行的内容使用markdown渲染html作为组件的描述
                        let demoInfo = tokens[idx].info
                          .trim()
                          .match(/^demo\s+(.*)$/)
                        let description =
                          demoInfo && demoInfo.length > 1 ? demoInfo[1] : ''
                        let descriptionHTML = description
                          ? markdownRender.render(description)
                          : ''
                        // 2.获取代码块内的html和js代码
                        let content = tokens[idx + 1].content
                        // 3.使用自定义开发组件【DemoBlock】来包裹内容并且渲染成案例和代码示例
                        return `<demo-block>
                        <div class="source" slot="source">${content}</div>
                        ${descriptionHTML}
                        <div class="highlight" slot="highlight">`
                      } else {
                        return '</div></demo-block>\n'
                      }
                    }
                  }
                ]
              ]
            }
          }
        ]
      }

from vue-markdown-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.