You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We yamlify markdown, which often contains long-ish URLs. We would like to have the yaml not break those URLs up, so the yaml is easier to read, and so they can be searched for in our repo.
Example:
constobj={"mystring": "[this is an svg of something or other](https://cdn.abc.com/2022/11/18/1668788169568.abcde-abcdefhi-302x300.svg)",}yaml.stringify(obj)
output:
mystring: "[this is an svg of something or
other](https://cdn.abc.com/2022/11/18/1668788169568.abcde-abcdefhi-302x300.sv\
g)"
Describe the solution you'd like
An option like:
yaml.scalarOptions.str.fold.breakOn='whitespace'
Or maybe it could allow a list of regexes, in priority order, where the default (matching behaviour now, presumably) is:
// prefer to break on whitespace, failing that, break on non-word characters, failing that break on any character.yaml.scalarOptions.str.fold.breakOn=[/\S/,/\W/,/./]
And people like us would update it to
// prefer to break on whitespace, failing that, no matching break characters could be found , so don't break, even at `lineWidth`.yaml.scalarOptions.str.fold.breakOn=[/\S/]
Describe alternatives you've considered
We don't want to disable or set scalarOptions.fold.lineWidth to something very high, because that'll effectively turn off folding completely. We do want folding, but we just want it to only break on whitespace.
Additional context
This doesn't just apply to markdown, we also have this problem in other strings that use long format parameters.
The text was updated successfully, but these errors were encountered:
Would using the option singleQuote: true work for you? The problematic behaviour is specific to double-quoted scalars, so:
YAML.stringify(obj,{singleQuote: true})
mystring: '[this is an svg of something or other](https://cdn.abc.com/2022/11/18/1668788169568.abcde-abcdefhi-302x300.svg)'
If that's not sufficient, you could submit a PR for an option like doubleQuotedAllowFoldEscape that defaults to true, but it'd be nice if that could be avoided.
We yamlify markdown, which often contains long-ish URLs. We would like to have the yaml not break those URLs up, so the yaml is easier to read, and so they can be searched for in our repo.
Example:
output:
Describe the solution you'd like
An option like:
Or maybe it could allow a list of regexes, in priority order, where the default (matching behaviour now, presumably) is:
And people like us would update it to
Describe alternatives you've considered
We don't want to disable or set
scalarOptions.fold.lineWidth
to something very high, because that'll effectively turn off folding completely. We do want folding, but we just want it to only break on whitespace.Additional context
This doesn't just apply to markdown, we also have this problem in other strings that use long format parameters.
The text was updated successfully, but these errors were encountered: