3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-12 11:48:29 +01:00

Give an inline node no mark Atlassian's schema withholds from it, in every reader

This commit is contained in:
2026-10-14 13:27:53 +02:00
committed by Lillem4n
parent dcbdf3683d
commit 1ae7ba6992
21 changed files with 122 additions and 102 deletions
+9 -7
View File
@@ -519,7 +519,7 @@ Hello, !adf:textBreak{}world — **Hello, !adf:textBreak{}world** — `a`!adf:te
An inline node's marks ride the spelling wrapped around them, never the block sections' reserved
`marks` key. `code`, `em`, `strike` and `strong` keep their markdown spellings, and are not
directive names: `!adf:em[x]` is a named error. `border`, `subsup`, `textColor` and `underline` are
inline directives, content required, holding something besides hard breaks. `link` keeps its
inline directives, content required, holding a node that takes the mark. `link` keeps its
markdown spelling wherever CommonMark holds it — `<url>` for a bare autolink-shaped text, else
`[text](url "title")` — and is the inline directive `!adf:link[text]{attrs}` only where CommonMark
does not: an attribute besides `href` and `title`, an `href` or `title` no canonical escape spells
@@ -530,8 +530,8 @@ CommonMark could spell is a named error, and so is one spelling none. No link wr
nesting, which is CommonMark's own rule: a `[text]` already holding one leaves the outer brackets
literal text, and the directive form, open to no literal reading, is a named error. ADF holds no
empty text node, so a link whose text is empty reads as its destination linked, `[](/url)` as
`/url`, and one whose destination is empty too, `[]()`, as nothing. A link text holding only hard
breaks reads the same, followed by its hard breaks.
`/url`, and one whose destination is empty too, `[]()`, as nothing. A link text holding no node
that takes a link reads the same, followed by its nodes.
- `border` — Attributes: `color` (string, `#rrggbb` or `#rrggbbaa`), `size` (number, 1–3).
- `code`, `em`, `strike`, `strong` — Attributes: none.
@@ -548,16 +548,18 @@ A block's `marks` key also holds these, which no inline spelling wraps:
- `fragment` — Attributes: `localId` (string), `name` (string).
- `indentation` — Attributes: `level` (number, 1–6).
A spelling adds its mark to every inline node it wraps but a hard break, which Atlassian's schema
gives no marks, and nesting is the marks array in order, outermost first: `_!adf:underline[x]_`
gives marks `[em, underline]`, `!adf:underline[_x_]` the reverse. `adfToLosslessMarkdown` nests in
A spelling adds its mark to every inline node it wraps but one Atlassian's schema withholds the mark
from: `hardBreak`, `date`, `emoji`, `inlineCard`, `mention` and `status` take none a spelling makes,
and `mediaInline` only `border` and `link`. Nesting is the marks array in order, outermost first:
`_!adf:underline[x]_` gives marks `[em, underline]`, `!adf:underline[_x_]` the reverse. `adfToLosslessMarkdown` nests in
the order the array holds rather than sorting it — `docs/decisions.md` §Equality is deep restores
the array, not a set — and opens each spelling once over the longest run of adjacent inline nodes
carrying an identical mark, attributes included, at that depth: `attrs: {}` differs from no `attrs`,
and a directive spells it `{attrs=empty}`. A run breaks at every node the emitter carries, so no
emitted carry sits inside a mark spelling.
An inline node whose marks no nesting spells — a hard break holding any mark, a mark type the first
An inline node whose marks no nesting spells — a node holding a mark Atlassian's schema withholds
from it, a mark type the first
list above does not hold, an attrs key its spelling does not list, a value that is not the
spelling's type, an attribute the spelling needs and the mark lacks, an empty `attrs` on a mark CommonMark spells, an order
putting a code span outside another mark, `code` over anything but a text node holding text, or over