vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

fix: using file inclusion, if included file contains relative path, t…

Open windsonR opened this issue 10 months ago • 2 comments

When using markdown file inclusion

The included markdown file(a.md) wll directly copy file content to replace the comment in a file(b.md)

But if the included markdown file contains relative path (such as ![](./a.png)), when access b.html, it will report error(./a.png can not resolve by vite)

reproduce repo

In reproduce repo, i've add a patch to fix this.

This PR replace the relative path to absolute path to fix this problem.

windsonR avatar Apr 03 '24 07:04 windsonR

This will be a breaking change and not sure if we want that. Including markdown should behave similar to importing components. And if in a vue component you have a path relative to that file, that won't be transformed to something else.

brc-dd avatar Apr 26 '24 19:04 brc-dd

It's not like vue component for now. The file inclusion is just copy the markdown file's content to replace the @include comment.

Maybe should re-implement File inclusion?

To make sure that it is not simply copying the content and replacing the file include comment with it, but injecting the compiled markdown file to the comment?

windsonR avatar Apr 28 '24 03:04 windsonR