Repository navigation
feat(renderer): interpolate placeholders in bound props - #516
Open
adamdehaven wants to merge 2 commits into
Open
adamdehaven wants to merge 2 commits into
adamdehaven wants to merge 2 commits into
Conversation
Resolve placeholders such as path or default in bound string props from document, ancestor and slot data. The result is always a string. Placeholders read own properties only and never call functions. The assembled value is checked before use, and an unsafe prop is removed with a warning. Malformed templates and JSON values keep the old behavior. Also treat malformed percent encoding in link props as unsafe instead of throwing. Closes nuxt-content#515
commit: |
Contributor
Author
|
Also porting forward to Comark: comarkdown/comark#490 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
:andv-bind:string props can now mix fixed text with{{ }}placeholders:Placeholders resolve against the same data as text bindings. The result is always a string.
Resolves #515
How it works
src/runtime/utils/template.ts.MDCRenderer.vuecalls it frompropsToDataRxBind.validatePropand the unsafe link prefixes. An unsafe prop is removed with a warning that names the prop only.isAnchorLinkAllowedno longer throws on malformed%. Link props treat it as unsafe.Compatibility
These values keep the old behavior and are not interpolated:
:, andkey,ref,isandstyle.A
:prop that already held a well-formed{{ }}now interpolates.