diff --git a/docs/decisions.md b/docs/decisions.md index c34b34a..e0251f2 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -1453,9 +1453,11 @@ alt text. Wiki markup has no spelling for some nodes and marks, a layout among them. The lossless wiki writer wraps each such node's ADF JSON in Jira's own `{adf}` macro: `{adf:display=block}` for a -block node, `{adf:display=inline}` for an inline node or each node of a marked run. The round-trip holds, and -Jira still renders the document. The lossy wiki writer ships beside it for consumers who want wiki -markup alone: it drops the form of what wiki markup cannot spell and keeps its content. +block node, `{adf:display=inline}` for an inline node or each node of a marked run. A +`{adf:display=inline}` holding an array shows "Invalid ADF Macro", where one holding a node renders +it. The round-trip holds, and Jira still renders the document. The lossy wiki writer ships beside +it for consumers who want wiki markup alone: it drops the form of what wiki markup cannot spell and +keeps its content. Confirmed 2026-11-16 on a live Jira Cloud site: a description holding `{adf:display=block}` around a `table` node's JSON rendered a table, and `{adf:display=inline}` around a `status` node's JSON @@ -1510,12 +1512,12 @@ the nearest-looking panel type, not `info`, and a backslash before `:` stays tex Checked again 2026-11-17 for the lossless writer's backslashes and inline carries. Jira drops the backslash before `(`, `)`, `?`, `!`, `#`, `[`, `]`, `{`, `}`, `*`, `+`, `-`, `^`, `_` and `~`, and keeps it as text before `:`, `;`, `.`, `,`, a letter, a digit and another backslash. So a backslash -before a smiley's `(`, or its closing `)`, stops it (`:\)` reads as the text `:)`), while `:D`, `:P`, -a `:` or `;` ending a node inside a line, and the `h` of `h1.` and the `b` of `bq.` at a line's start -ride the carry. An escaped `|` still ends a table cell, so a text holding `|` rides the carry there; -`|`, `\\`, `\"` and `\n` inside a carry's JSON survive in a cell and in a paragraph. A -`{adf:display=inline}` holding an array shows "Invalid ADF Macro", where one holding a node renders -it, so a run of nodes is one macro per node. +before a smiley's `(`, or its closing `)`, stops it (`:\)` reads as the text `:)`). No backslash +stops `:D`, `:P`, a `:` or `;` ending a node inside a line, or the `h` of `h1.` and the `b` of `bq.` +at a line's start, so a text holding one rides the carry. + +An escaped `|` still ends a table cell, so a text holding `|` rides the carry there. `|`, `\\`, +`\"` and a newline inside a carry's JSON survive in a cell and in a paragraph. ## A plain wiki spelling stands for the attributes Jira's editor writes, and any other attribute rides the carry diff --git a/src/wiki/emit/adf-to-jira-wiki.test.ts b/src/wiki/emit/adf-to-jira-wiki.test.ts index 59d256c..3d8524f 100644 --- a/src/wiki/emit/adf-to-jira-wiki.test.ts +++ b/src/wiki/emit/adf-to-jira-wiki.test.ts @@ -207,7 +207,7 @@ test('escapes a character wiki markup would read as markup where it stands', () assert.equal(line('a :( b ;) c'), 'a :\\( b ;\\) c') }) -test('carries a text no backslash stops a smiley or a line-start word in', () => { +test('carries a text whose smiley or line-start word no backslash stops', () => { const carried = (value: string): string => inline(`{"text":${JSON.stringify(value)},"type":"text"}`) assert.equal(line('h1. not a heading'), carried('h1. not a heading')) assert.equal(line('Bq. not a quote'), carried('Bq. not a quote')) @@ -330,7 +330,7 @@ test('escapes a smiley the node edge cuts, unless the line ends there', () => { assert.equal(line('a ('), 'a (') }) -test('carries a text holding a pipe in a table cell, where a backslash would end the cell', () => { +test('carries a text holding a pipe in a table cell, where an escaped pipe still ends the cell', () => { assert.equal(wiki(table(plainTable, [cell('tableCell', text('a|b')), cell('tableCell', text('c'))])), `|${inline('{"text":"a|b","type":"text"}')}|c|`) assert.equal(wiki(table(plainTable, [cell('tableCell', text('x', { attrs: { href: 'https://example.com' }, type: 'link' }), text('|'))])), `|[x|https://example.com]${inline('{"text":"|","type":"text"}')}|`) assert.equal(wiki(table(plainTable, [cell('tableHeader', text('a|b'))])), `||${inline('{"text":"a|b","type":"text"}')}||`) diff --git a/src/wiki/emit/text-escaping.ts b/src/wiki/emit/text-escaping.ts index dcac3d9..36a9c82 100644 --- a/src/wiki/emit/text-escaping.ts +++ b/src/wiki/emit/text-escaping.ts @@ -35,7 +35,7 @@ function escapes(character: string, characters: readonly string[], index: number return character === '!' && after !== 'space' } -// A smiley reads wherever no letter or digit follows it; one the node's edge cuts may close in the next node's spelling. `undefined` where a smiley reads that no backslash stops: Jira keeps one before `:`, `;` and a letter, so only a `(` or a closing `)` takes it. +// A smiley reads wherever no letter or digit follows it; one the node's edge cuts may close in the next node's spelling. Returns the indexes to put a backslash before: only a `(` or a closing `)` takes one, since Jira keeps a backslash before `:`, `;` and a letter. `undefined` where a smiley reads that no such backslash stops. function smileyStops(characters: readonly string[], end: Side): Set | undefined { const stops = new Set() for (const [index, character] of characters.entries()) {