With @nuxtjs/markdownit, how can I resolve a image file in XXX.md file

151 Views Asked by At

I apply markdown in nuxt vue this way.

<template>
  <div class="doc-container">
    <div v-html="doc"/>
  </div>
</template>

<script>
import doc from './doc.md'
export default {
  name: 'doc',
  data() {
    return {
      doc:doc
    }
  },
}
</script>

in doc.md file, I need add a image, but how can I resolve the image path? http://localhost:3000/guide/~@/assets/images/create.jpg 404 (Not Found)

![image](~@/assets/images/create.jpg)

now the problem is

1

There are 1 best solutions below

0
Mulhoon On

You can drop your images in the /static folder. e.g. a file placed here /static/images/create.jpg would be mapped to the root like this:

![image](/images/create.jpg)