madskristensen / MarkdownEditor2022

A Visual Studio extension
Apache License 2.0
176 stars 37 forks source link

Relative links don't function in the previewer #123

Open bwood4 opened 1 month ago

bwood4 commented 1 month ago

Describe the bug Relative links don't function in the previewer.

To Reproduce Steps to reproduce the behavior:

  1. Open an empty folder in Visual Studio called "MarkdownEditorTest"
  2. Create a new file called "Test1.md" with the following text:
    # Header 1
    [This is broken](Test2.md)
  3. Create a new file called "Test2.md" with the following text:
    This isn't opened by the link.

Expected behavior Test2.md should be opened when the link in Test1.md is clicked. Instead, nothing happens. Hovering over the link in the previewer shows that the URL is "browsing-file-host/MarkdownEditorTest/Test2.md". I believe it is incorrectly adding the parent folder into the path.

Additional context Changing the path to this:

[This works](https://browsing-file-host/Test2.md)

Allows the link to function as normal. This isn't ideal, though.

edstegman commented 3 weeks ago

Another work around: [This also works](../Test2.md)

Another bug, or expected behavior? The linked file is not opened in the same editor as when opening from the Solution Explorer window. The linked file is opened in a different editor window in the tab well. The problem is the right side preview window area is not rendering any content and remains blank.

When I already have the linked file open in Visual Studio and then click a link to it from another sibling md file, I will then see 2 tabs opened in VS for the same file. It would be great if the behavior was to open the file from the solution in the normal editor so everything just worked. Barring that, it would be great if the preview pane worked whenever an md file was opened or navigated to.

When hovering the mouse over the tab of the linked file that is opened, only the file name is shown. Normally, when opening a file in VS and hovering over the tab, the full path to the file is shown.