Fix a variety of issues with HTML → Markdown conversion (#8004)
* Fix a variety of issues with HTML → Markdown conversion Signed-off-by: Robin Townsend <robin@robin.town> * Fix lint Signed-off-by: Robin Townsend <robin@robin.town> * Fix @room pill formatting not being applied to link text Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
parent
65691202f7
commit
c10ac9e4a0
3 changed files with 422 additions and 260 deletions
178
test/editor/__snapshots__/deserialize-test.js.snap
Normal file
178
test/editor/__snapshots__/deserialize-test.js.snap
Normal file
|
@ -0,0 +1,178 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`editor/deserialize html messages escapes angle brackets 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "\\\\> \\\\\\\\<del>no formatting here\\\\\\\\</del>",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`editor/deserialize html messages escapes asterisks 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "\\\\*hello\\\\*",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`editor/deserialize html messages escapes backslashes 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "C:\\\\\\\\My Documents",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`editor/deserialize html messages escapes backticks in code blocks 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "\`\`this → \` is a backtick\`\`",
|
||||
"type": "plain",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "\`\`\`\`",
|
||||
"type": "plain",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "and here are 3 of them:",
|
||||
"type": "plain",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "\`\`\`",
|
||||
"type": "plain",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "\`\`\`\`",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`editor/deserialize html messages escapes backticks outside of code blocks 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "some \\\\\`backticks\\\\\`",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`editor/deserialize html messages escapes square brackets 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "\\\\[not an actual link\\\\](https://example.org)",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`editor/deserialize html messages escapes underscores 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "\\\\_\\\\_emphasis\\\\_\\\\_",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`editor/deserialize html messages preserves nested formatting 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "a<sub>b_c**d<u>e</u>**_</sub>",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`editor/deserialize html messages preserves nested quotes 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "> foo",
|
||||
"type": "plain",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "> ",
|
||||
"type": "plain",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "> > bar",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`editor/deserialize html messages surrounds lists with newlines 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"text": "foo",
|
||||
"type": "plain",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "- bar",
|
||||
"type": "plain",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "
|
||||
",
|
||||
"type": "newline",
|
||||
},
|
||||
Object {
|
||||
"text": "baz",
|
||||
"type": "plain",
|
||||
},
|
||||
]
|
||||
`;
|
Loading…
Add table
Add a link
Reference in a new issue