cherry-pick(#33686): chore: escape more yaml values
This commit is contained in:
parent
b3aaee0248
commit
e3c5986c5b
|
|
@ -63,7 +63,7 @@ function yamlStringNeedsQuotes(str: string): boolean {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Strings that start with a special indicator character need quotes
|
// Strings that start with a special indicator character need quotes
|
||||||
if (/^[&*].*/.test(str))
|
if (/^[&*\],].*/.test(str))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Strings containing ':' followed by a space or at the end need quotes
|
// Strings containing ':' followed by a space or at the end need quotes
|
||||||
|
|
|
||||||
|
|
@ -465,6 +465,12 @@ it('should escape yaml text in text nodes', async ({ page }) => {
|
||||||
<details>
|
<details>
|
||||||
<summary>one: <a href="#">link1</a> "two <a href="#">link2</a> 'three <a href="#">link3</a> \`four</summary>
|
<summary>one: <a href="#">link1</a> "two <a href="#">link2</a> 'three <a href="#">link3</a> \`four</summary>
|
||||||
</details>
|
</details>
|
||||||
|
<ul>
|
||||||
|
<a href="#">one</a>,<a href="#">two</a>
|
||||||
|
(<a href="#">three</a>)
|
||||||
|
{<a href="#">four</a>}
|
||||||
|
[<a href="#">five</a>]
|
||||||
|
</ul>
|
||||||
`);
|
`);
|
||||||
|
|
||||||
await checkAndMatchSnapshot(page.locator('body'), `
|
await checkAndMatchSnapshot(page.locator('body'), `
|
||||||
|
|
@ -476,6 +482,17 @@ it('should escape yaml text in text nodes', async ({ page }) => {
|
||||||
- text: "'three"
|
- text: "'three"
|
||||||
- link "link3"
|
- link "link3"
|
||||||
- text: "\`four"
|
- text: "\`four"
|
||||||
|
- list:
|
||||||
|
- link "one"
|
||||||
|
- text: ","
|
||||||
|
- link "two"
|
||||||
|
- text: (
|
||||||
|
- link "three"
|
||||||
|
- text: ") {"
|
||||||
|
- link "four"
|
||||||
|
- text: "} ["
|
||||||
|
- link "five"
|
||||||
|
- text: "]"
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue