Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] VuePress failed to resolve images without ./ #941

Closed
Karlatemp opened this issue Jun 14, 2022 · 6 comments · Fixed by #1103
Closed

[Bug report] VuePress failed to resolve images without ./ #941

Karlatemp opened this issue Jun 14, 2022 · 6 comments · Fixed by #1103
Labels
enhancement New feature or request package:markdown

Comments

@Karlatemp
Copy link

Description

VuePress can't resolve images without ./

image


package.json

{
  "devDependencies": {
    "@vuepress/plugin-medium-zoom": "2.0.0-beta.48",
    "@vuepress/plugin-nprogress": "2.0.0-beta.48",
    "@vuepress/plugin-pwa": "2.0.0-beta.48",
    "vuepress": "2.0.0-beta.48"
  },
  "scripts": {
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs"
  }
}

.vuepress/config.js

module.exports = {
  "title": "mirai",
  "description": "Mirai Project",
  "markdown": {
    "lineNumbers": true
  },
  "dest": "E:\\IDEAProjects\\project-mirai_docs\\vuepress-dist",
}

Reproduction

null

Used Package Manager

yarn

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900K
    Memory: 45.02 GB / 95.81 GB
  Binaries:
    Node: 14.17.4 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.6.0 - C:\Program Files\nodejs\npm.CMD
  Utilities:
    Git: 2.35.3. - /cmd/git
  Browsers:
    Chrome: 102.0.5005.115
    Edge: Spartan (44.19041.1266.0), Chromium (102.0.1245.41), ChromiumDev (Yes it loads)
  npmPackages:
    @vuepress/bundler-vite:  2.0.0-beta.48
    @vuepress/bundler-webpack: Not Found
    @vuepress/cli:  2.0.0-beta.48
    @vuepress/client:  2.0.0-beta.48
    @vuepress/core:  2.0.0-beta.48
    @vuepress/markdown:  2.0.0-beta.48
    @vuepress/plugin-active-header-links:  2.0.0-beta.48
    @vuepress/plugin-back-to-top:  2.0.0-beta.48
    @vuepress/plugin-container:  2.0.0-beta.48
    @vuepress/plugin-docsearch: Not Found
    @vuepress/plugin-external-link-icon:  2.0.0-beta.48
    @vuepress/plugin-git:  2.0.0-beta.48
    @vuepress/plugin-google-analytics: Not Found
    @vuepress/plugin-medium-zoom: 2.0.0-beta.48 => 2.0.0-beta.48
    @vuepress/plugin-nprogress: 2.0.0-beta.48 => 2.0.0-beta.48
    @vuepress/plugin-palette:  2.0.0-beta.48
    @vuepress/plugin-prismjs:  2.0.0-beta.48
    @vuepress/plugin-pwa: 2.0.0-beta.48 => 2.0.0-beta.48
    @vuepress/plugin-pwa-popup: Not Found
    @vuepress/plugin-register-components: Not Found
    @vuepress/plugin-search: Not Found
    @vuepress/plugin-shiki: Not Found
    @vuepress/plugin-theme-data:  2.0.0-beta.48
    @vuepress/plugin-toc: Not Found
    @vuepress/shared:  2.0.0-beta.48
    @vuepress/theme-default:  2.0.0-beta.48
    @vuepress/utils:  2.0.0-beta.48
    vue:  3.2.37
    vue-loader: Not Found
    vue-router:  4.0.16
    vuepress: 2.0.0-beta.48 => 2.0.0-beta.48
    vuepress-vite:  2.0.0-beta.48
    vuepress-webpack: Not Found
@Mister-Hope
Copy link
Member

@Mister-Hope Mister-Hope closed this as not planned Won't fix, can't repro, duplicate, stale Jun 14, 2022
@Mister-Hope Mister-Hope added the question Asking question label Jun 14, 2022
@Karlatemp
Copy link
Author

But many md renders support it. I think vp should allow users to use it.
Also it wasn't included in Migrating from v1

@Mister-Hope
Copy link
Member

Mister-Hope commented Jun 14, 2022

@meteorlxy
Copy link
Member

VitePress implement a custom markdown-it plugin to resolve this issue:

However, it's not an ideal solution. It made the alias fail to work.

@Mister-Hope
Copy link
Member

I think it does be better to make:

  • ![img](foo/bar.png) be ./foo/bar.png
  • <img src="foo/bar.png" /> be bar.png in package foo

Just like the absolute markdown link.


Markdown syntax can be special handled to align user's intuition when using other markdown tools, and advanced operations can be preserved when using html tags. @meteorlxy

@Mister-Hope
Copy link
Member

Mister-Hope commented Jun 15, 2022

Or in another word, I think it's do strange for people to use markdown syntax ![img](foo/bar.png) to refrence an alia. Writing <img src"xxx" /> to do that fits people's intuition better.

Just the same as the absolute markdown link, it's quite strange to use an absolute markdown link which should be keeped as is without pending base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request package:markdown
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants