feat: new option: restrict path aliases that do not start with the prefix (close #1646)#1647
feat: new option: restrict path aliases that do not start with the prefix (close #1646)#1647LincZero wants to merge 16 commits intovuepress:mainfrom
Conversation
Mister-Hope
left a comment
There was a problem hiding this comment.
Since Vite's default static file is covering media files, we can also handle video and audio here as well.
Pull Request Test Coverage Report for Build 21834429282Details
💛 - Coveralls |
Mister-Hope
left a comment
There was a problem hiding this comment.
Like I said previously, video and audio tags shall also be tracked.
This means you should also modify the regexp in the first replacer function.
|
Should the unit test of the media tag be conducted in This won't be available for supplementation until tomorrow. |
|
Audio and video tags can have src attribute. |
|
@meteorlxy Needs review here. |
|
Can you try to rework this under the new bundler resolution? The logic would be more simple than before. |
|
You should update e2e test at markdown/image |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new aliasSupport option to the markdown assetsPlugin to control how “non-strict” asset paths (those not starting with ./, ../, /, or a protocol) are treated—either as aliases (current behavior) or as relative paths (by prepending ./). It also expands the HTML asset rewriting to include additional media tags beyond <img>.
Changes:
- Add
aliasSupport?: boolean | '@-prefix'toassetsPluginand thread it into link resolution logic. - Extend HTML asset attribute rewriting from
<img>to<audio>,<video>, and<source>. - Add test coverage for HTML media tags using the new option.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| packages/markdown/src/plugins/assetsPlugin/assetsPlugin.ts | Adds aliasSupport option + expands HTML tag matching to more media tags. |
| packages/markdown/src/plugins/assetsPlugin/resolveLink.ts | Implements the aliasSupport behavior in link resolution. |
| packages/markdown/tests/plugins/assetsPlugin.spec.ts | Adds tests for media tags and the new option behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Before submitting the PR, please make sure you do the following
close #123).What is the purpose of this pull request?
Description
close #1646
Screenshots
Before
After