Closed aycakahya closed 4 years ago
You have to download the image file, and put in the correct static path.
You need to understand that vue-showdown
only parses markdown file in browser, not in webpack compilation.
In your case, I suggest you to use something like markdown-loader / vue-markdown-loader, to parse the markdown file in webpack compilation, instead of using vue-showdown
![image.png](/.attachments/image-3bc078e5-c2fb-48d8-bc00-fff6dc34fb25.png)
Is the method of showing the picture in this way a vue-markdown-loader? I used it this way, but again the problem has not been solved.
webpack.config.js:
var resolve = require('path').resolve
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
output: {
path: resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: ['vue-app']
}
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.md$/,
loader: 'vue-markdown-loader'
}
]
},
devServer: {
disableHostCheck: true
}
}
You need to understand what happens on ![image.png](/.attachments/image-3bc078e5-c2fb-48d8-bc00-fff6dc34fb25.png)
:
It equals <img src="/.attachments/image-3bc078e5-c2fb-48d8-bc00-fff6dc34fb25.png">
in your .vue
file.
If you can make it displayed in your .vue
file, it would display in your .md
file
vue-showdown:
![image.png](xxx)
to <img src="xxx">
, and put it directly in htmlvue-markdown-loader:
![image.png](xxx)
to <img src="xxx">
, and put it into a .vue
filevue-loader
/ url-loader
/ file-loader
will process it, trying to resolve the xxx
file in your project if it is a relative path (in your case, it is a absolute path and will not be resolved at all)
Vue file:
welcome.md file:
![image.png](/.attachments/image-3bc078e5-c2fb-48d8-bc00-fff6dc34fb25.png)
I download the md file from the azure devops wiki. I need to use this in my project, but articles etc. But the picture is not displayed. What is the reason?
npm install vue-showdown: I made the necessary installation with.
main.js: