Open segevfiner opened 1 year ago
html does not allow stacking regular space; it is a feature of HTML, not vue.
from a comment of https://stackoverflow.com/questions/65381611/add-whitespace-in-vue.
You can already build such a directive.
In your example, the content inside CodeBlock
is passed to the default
slot. You can intercept it in the directive, then convert the content to a string and display it.
What problem does this feature solve?
The SFC compiler only preserves whitespace in
pre
tag, if you want to preserve whitespace when passing content to custom components or tags that require whitespace preservation you have to contort yourself to pass content wrapped in apre
tag. It would be nice to have some directives that preserve whitespace in any arbitrary tag so this isn't necessary.What does the proposed API look like?