Incorrect markdown image insertion path

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.