Skip to content

Markdown preview no longer shows images with root relative path #110812

Closed

Description

@vsudakov
  • VSCode Version: 1.51.1
  • OS Version: on both Fedora 32 and Linux Mint 20

Steps to Reproduce:

  1. git clone [email protected]:vsudakov/issues_vscode_1_40_0_markdownPreviewRootRelativeImg.git
  2. cd issues_vscode_1_40_0_markdownPreviewRootRelativeImg
  3. code .
  4. Image doesn't display in readme.md:

Screenshot from 2020-11-17 17-50-50

Does this issue occur when all extensions are disabled?: Yes

This issue had already occurred in past: #84728
In the latest insiders vs-code build - it's not fixed as well.

Activity

  1. added
    help wanted
    markdown-ext
    on Dec 19, 2020
  2. jeanp413 commented on Jan 6, 2021

    @jeanp413
    Contributor

    Matt Bierner (@mjbvz) I took a look at this and found that the issue is that the resource vscode-webview-resource uri is invalid, is missing /file/// before /home/jeanpierre/...

    I was looking how to fix it but I can't find the place where the img.src gets mapped to a vscode-webview-resource

    <img src="/home/jeanpierre/Desktop/issues_vscode_1_40_0_markdownPreviewRootRelativeImg/assets/2019-11-13_16_36_37.png" alt="" class="" id="image-hash-904852482">
    
    vscode-webview-resource://74f85878-6ad4-475b-bf60-b0c1370666e2/home/jeanpierre/Desktop/issues_vscode_1_40_0_markdownPreviewRootRelativeImg/assets/2019-11-13_16_36_37.png
    vscode-webview-resource://74f85878-6ad4-475b-bf60-b0c1370666e2/file///home....
    

    can you give me some code pointers?

  3. bart-gander commented on Jan 12, 2021

    @bart-gander

    Jean Pierre (@jeanp413) here is my quick and dirty fix for this issue:
    bart-gander@0214f91

  4. mjbvz commented on Jan 13, 2021

    @mjbvz
    Contributor

    Jean Pierre (@jeanp413) Start by looking in the markdown link normalizer

    // Normalize VS Code schemes to target the current version

    I believe this is passed the raw image links and tries to transform them into url that VS Code can render in the preview

  5. jeanp413 commented on Jan 19, 2021

    @jeanp413
    Contributor

    Thanks Matt Bierner (@mjbvz) and @bartholomew-gander after spending some more time looking at this I think I found a proper fix for it

  6. added a commit that references this issue on Jan 19, 2021
    727c07b
  7. added a commit that references this issue on Jan 19, 2021
    7f4d67c
  8. added
    unreleased
    insiders-released
    and removed
    unreleased
    on Jan 19, 2021
  9. added
    bug
    on Jan 25, 2021
  10. locked and limited conversation to collaborators on Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bughelp wantedinsiders-releasedmarkdown-extverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions