mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-21 15:42:58 +01:00
Name the marker a list takes after a list of its kind, from the list right before it
This commit is contained in:
@@ -333,10 +333,10 @@ test('names the CommonMark spelling to write for the directive form a node Commo
|
|||||||
assert.equal(content(losslessMarkdownToAdf('!adf:blockquote\nPart.\n!adf:/blockquote\n')), named('blockquote', 'each line behind `> `'))
|
assert.equal(content(losslessMarkdownToAdf('!adf:blockquote\nPart.\n!adf:/blockquote\n')), named('blockquote', 'each line behind `> `'))
|
||||||
assert.equal(content(losslessMarkdownToAdf('!adf:heading {level=2}\nPart.\n!adf:/heading\n')), named('heading', 'one `#` per level before its text, `## Title` at level 2'))
|
assert.equal(content(losslessMarkdownToAdf('!adf:heading {level=2}\nPart.\n!adf:/heading\n')), named('heading', 'one `#` per level before its text, `## Title` at level 2'))
|
||||||
assert.equal(content(losslessMarkdownToAdf('!adf:paragraph\nPart.\n!adf:/paragraph\n')), named('paragraph', 'its text alone'))
|
assert.equal(content(losslessMarkdownToAdf('!adf:paragraph\nPart.\n!adf:/paragraph\n')), named('paragraph', 'its text alone'))
|
||||||
assert.equal(content(losslessMarkdownToAdf('!adf:bulletList\n!adf:listItem\nPart.\n!adf:/listItem\n!adf:/bulletList\n')), named('bulletList', 'each item behind `- `, or behind `* ` right after another bullet list'))
|
assert.equal(content(losslessMarkdownToAdf('!adf:bulletList\n!adf:listItem\nPart.\n!adf:/listItem\n!adf:/bulletList\n')), named('bulletList', 'each item behind `- `, or behind `* ` where the list right before it takes `- `'))
|
||||||
assert.equal(
|
assert.equal(
|
||||||
content(losslessMarkdownToAdf('!adf:orderedList {order=5}\n!adf:listItem\nPart.\n!adf:/listItem\n!adf:/orderedList\n')),
|
content(losslessMarkdownToAdf('!adf:orderedList {order=5}\n!adf:listItem\nPart.\n!adf:/listItem\n!adf:/orderedList\n')),
|
||||||
named('orderedList', 'each item behind its number, counting up from `5. `, or from `5) ` right after another ordered list'),
|
named('orderedList', 'each item behind its number, counting up from `5. `, or from `5) ` where the list right before it takes `.`'),
|
||||||
)
|
)
|
||||||
assert.equal(content(losslessMarkdownToAdf('!adf:codeBlock\n```\nx\n```\n!adf:/codeBlock\n')), named('codeBlock', 'its text in a fence of more backticks than any run it holds, its language after the opening fence'))
|
assert.equal(content(losslessMarkdownToAdf('!adf:codeBlock\n```\nx\n```\n!adf:/codeBlock\n')), named('codeBlock', 'its text in a fence of more backticks than any run it holds, its language after the opening fence'))
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|||||||
@@ -273,13 +273,13 @@ function directiveNode(block: DirectiveBlock, reading: Reading, path: ConvertErr
|
|||||||
function spellingToWrite(node: AdfNode): string | undefined {
|
function spellingToWrite(node: AdfNode): string | undefined {
|
||||||
if (node.type !== 'orderedList') return commonMarkSpellings.get(node.type)
|
if (node.type !== 'orderedList') return commonMarkSpellings.get(node.type)
|
||||||
const order = String(nodeAttrs(node)['order'])
|
const order = String(nodeAttrs(node)['order'])
|
||||||
return `each item behind its number, counting up from \`${order}. \`, or from \`${order}) \` right after another ordered list`
|
return `each item behind its number, counting up from \`${order}. \`, or from \`${order}) \` where the list right before it takes \`.\``
|
||||||
}
|
}
|
||||||
|
|
||||||
// One entry per node `commonMarkSpelling` spells in the lossless flavour, kept here because this refusal is its only reader; a node missing here is refused naming no spelling.
|
// One entry per node `commonMarkSpelling` spells in the lossless flavour, kept here because this refusal is its only reader; a node missing here is refused naming no spelling.
|
||||||
const commonMarkSpellings: ReadonlyMap<string, string> = new Map([
|
const commonMarkSpellings: ReadonlyMap<string, string> = new Map([
|
||||||
['blockquote', 'each line behind `> `'],
|
['blockquote', 'each line behind `> `'],
|
||||||
['bulletList', 'each item behind `- `, or behind `* ` right after another bullet list'],
|
['bulletList', 'each item behind `- `, or behind `* ` where the list right before it takes `- `'],
|
||||||
['codeBlock', 'its text in a fence of more backticks than any run it holds, its language after the opening fence'],
|
['codeBlock', 'its text in a fence of more backticks than any run it holds, its language after the opening fence'],
|
||||||
['heading', 'one `#` per level before its text, `## Title` at level 2'],
|
['heading', 'one `#` per level before its text, `## Title` at level 2'],
|
||||||
['mediaSingle', '``, or `[](href)` when linked'],
|
['mediaSingle', '``, or `[](href)` when linked'],
|
||||||
|
|||||||
Reference in New Issue
Block a user