Pin what the doomed openers keep: the carry and the image literal brackets hold
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ it named converts.
|
||||
| Input | `0.1.0` | `0.2.0` |
|
||||
| --- | --- | --- |
|
||||
| a link whose `href` or `title` no CommonMark escape spells, on emit | `unspellable-link` | spells `!adf:link[text]{attrs}` |
|
||||
| a link whose text already holds one (`[<https://example.com/>](/v)`) | drops the outer link | leaves the outer brackets literal text |
|
||||
| a link whose text already holds one (`[a<https://example.com/>b](/v)`) | marks every node the inner link does not, splitting the outer link around it | leaves the outer brackets literal text |
|
||||
| a leaf node given a body (`media`, `listBreak`) | `unsupported-node-shape` | `malformed-directive` |
|
||||
| a node with a block body written as a leaf (`panel`) | `unsupported-node-shape` | `malformed-directive` |
|
||||
| an empty node the `::taskItem` spelling row names, written as a leaf | parses | `malformed-directive` |
|
||||
|
||||
@@ -39,7 +39,7 @@ type Run = { canClose: boolean; canOpen: boolean; character: string; index: numb
|
||||
// `container` is `undefined` inside a directive's content slot, the emitter's `bracketed`.
|
||||
type Scan = {
|
||||
container: LineContainer | undefined
|
||||
// Pieces below this have been walked for openers to deactivate, so a nest of doomed brackets stays linear.
|
||||
// Pieces below this have been walked for openers to deactivate: one left active reaches closeLink, whose image and carry guards refuse what literal brackets hold fine.
|
||||
deactivatedBefore: number
|
||||
definitions: LinkDefinitions
|
||||
openingSpellableLink: boolean
|
||||
|
||||
@@ -841,6 +841,14 @@ test('leaves the brackets of a link whose text already holds one the text they a
|
||||
])
|
||||
})
|
||||
|
||||
// Literal brackets hold what no mark may, so the openers they doom give way before closeLink refuses a carry or an image inside them.
|
||||
test('keeps the carry and the image the brackets a nested link leaves literal hold', () => {
|
||||
assert.deepEqual(content(markdownToAdf('[[<http://x/>](/c)!adf:carry{json="{\\"type\\":\\"blockCard\\"}"}](/w)\n')), [
|
||||
{ content: [text('[['), marked('http://x/', link('http://x/')), text('](/c)'), { type: 'blockCard' }, text('](/w)')], type: 'paragraph' },
|
||||
])
|
||||
assert.deepEqual(content(markdownToAdf(' ](/i)[[<http://x/>](/c)](/w)](/v)\n')), [image('/v', 'a b [x[http://x/](/c)](/w)')])
|
||||
})
|
||||
|
||||
test('reads the reference links a definition resolves, and leaves the rest literal', () => {
|
||||
assert.deepEqual(content(markdownToAdf('[a][r]\n\n[r]: /url\n')), [{ content: [marked('a', link('/url'))], type: 'paragraph' }])
|
||||
assert.deepEqual(content(markdownToAdf('[a][]\n\n[a]: /url\n')), [{ content: [marked('a', link('/url'))], type: 'paragraph' }])
|
||||
|
||||
Reference in New Issue
Block a user