How to solve the problem of incorrect markdown image insert path
Mom, I wrote two blogs one day in a row. This blog is mainly about the incorrect markdown image insertion path.
In the previous article, I introduced the basic syntax of markdown and introduced how to insert images. however, one problem is that when an image is inserted in vscode, it can be perfectly previewed, but the image cannot be displayed when it is run on the local server or GitHub.
Like this, Images cannot be displayed.
In this case, you can view the source code of the webpage.
View File Directories
After that, enter the URL
http://localhost:4000/2018/09/07/Markdown%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95/02.jpg
If the image is perfectly displayed, it indicates that the image is correct and the path is incorrect.
{% asset_img example.jpg This is an example image %}
To reference the image. however, I personally think this is not very good. First, it is not a standard markdown syntax, and second, it cannot be previewed in real time. after a long time, Baidu finally found a solution on a blog.
First step
Find index. js in [Your hexo installation address] \ node_modules \ hexo-asset-image and open it for editing.
VaR beginpos = getposition (link, '/', 3) + 1; changed to VaR beginpos = getposition (link, '/', 1) + 1;
At this time, execute
hexo cleanhexo g hexo s
You can display images perfectly.
Go to bed early.
Incorrect markdown image insertion path