Giter VIP home page Giter VIP logo

Comments (7)

hmsk avatar hmsk commented on June 8, 2024

Seems that your component may be wrong to render the template.
I confirmed <a> is rendered correctly.

Browser

image

HTML

image

Markdown

image

Btw, the rendering config is same to default, so you don't need to give that option 😉

let md = require('markdown-it')({
  html: true
})

https://github.com/hmsk/frontmatter-markdown-loader/blob/master/index.js#L4

I may take a look if you publish the repo to reproduce the problem 👀

from frontmatter-markdown-loader.

AnthonyFromTheVault avatar AnthonyFromTheVault commented on June 8, 2024

You helped me realize that I was overthinking the configuration, and once I took out the additional options it worked completely as intended! 🙌 .

FYI for anyone else, keep the nuxt.config.js options simple if you want to use markdown-it as a parser:

extend(config, { isDev, isClient }) {
    config.module.rules.push({
      test: /\.md$/,
      loader: 'frontmatter-markdown-loader'
    })
}

from frontmatter-markdown-loader.

hmsk avatar hmsk commented on June 8, 2024

Glad to hear that you solved the problem.

I'm still curious about what was the exact problem in your end 🤔

let md = require('markdown-it')({
  html: true
})

Even if we give this as the custom compilation, that should work anyways.

from frontmatter-markdown-loader.

AnthonyFromTheVault avatar AnthonyFromTheVault commented on June 8, 2024

I think my problem was specifically with the webpack config I was including in my nuxt.config file:

let md = require('markdown-it')

...

build: {
    extend(config, { isDev, isClient }) {
      config.module.rules.push({
        test: /\.md$/,
        loader: 'frontmatter-markdown-loader',
        options: {
          markdown: body => {
            return md.render(body)
          }
        }
      })
    }
  }

When I remove the options object, all works as intended (and my html via markdown gets properly rendered):

let md = require('markdown-it')

...

build: {
    extend(config, { isDev, isClient }) {
      config.module.rules.push({
        test: /\.md$/,
        loader: 'frontmatter-markdown-loader'
      })
    }
  }

from frontmatter-markdown-loader.

hmsk avatar hmsk commented on June 8, 2024

oh, so you missed html: true for the option of markdown-it at all?
I thought my module has bug for custom compilation since your first sample was having html: true which must work for inline html tags.

from frontmatter-markdown-loader.

AnthonyFromTheVault avatar AnthonyFromTheVault commented on June 8, 2024

I had the html: true option set when I first encountered this issue, but I was also including the extra options on my webpack config which I think was my problem.

Importing markdown without the html: true option, and not including the options in my webpack config has everything working as expected 👍

from frontmatter-markdown-loader.

hmsk avatar hmsk commented on June 8, 2024

Thanks for your explanation ✨

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