3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 23:25:43 +01:00

Answer prose round 1: 1 🔴, 6 🟡 (0 misread); state the refusal beside the carry rule, date it, and fix the cause bullets and the message

This commit is contained in:
2026-11-04 19:42:55 +01:00
committed by Lillem4n
parent 18c35e0f78
commit b9fd34abfb
5 changed files with 16 additions and 11 deletions
+1 -1
View File
@@ -17,7 +17,7 @@
`localId` as `data-local-id`. Every other node is an element of class `adf-carry` holding the `localId` as `data-local-id`. Every other node is an element of class `adf-carry` holding the
node's JSON in `data-adf` and showing its content, links included. Every URL is written as the node's JSON in `data-adf` and showing its content, links included. Every URL is written as the
ADF holds it, `javascript:` included: sanitize HTML from an author you do not trust before ADF holds it, `javascript:` included: sanitize HTML from an author you do not trust before
showing it. It refuses an inline card a link marks, as `unsupported-node-shape`: Atlassian's schema gives a showing it. `adfToHtml` refuses an inline card a link marks, as `unsupported-node-shape`: Atlassian's schema gives a
card no link mark, and HTML nests no link in a link. card no link mark, and HTML nests no link in a link.
- `htmlToAdf` reads `adfToHtml`'s HTML back to the document it came from, a carry element from its - `htmlToAdf` reads `adfToHtml`'s HTML back to the document it came from, a carry element from its
`data-adf`. It reads that HTML as a browser's `innerHTML` writes it too (a raw `"` in text, `data-adf`. It reads that HTML as a browser's `innerHTML` writes it too (a raw `"` in text,
+1 -1
View File
@@ -526,7 +526,7 @@ content. No stylesheet ships. The complete dialect:
| `rule` | `<hr>` | | `rule` | `<hr>` |
| `text` marked `code`, `em`, `strong` | `<code>`, `<em>`, `<strong>`, the first mark outermost | | `text` marked `code`, `em`, `strong` | `<code>`, `<em>`, `<strong>`, the first mark outermost |
| an attribute its type holds that its element does not write, such as `localId`, on a paragraph, heading, quote, list, list item, code block, rule, emoji, mention, status, date or card | `data-*` named as HTML's `dataset` names it: `<p data-local-id="a1f3">` | | an attribute its type holds that its element does not write, such as `localId`, on a paragraph, heading, quote, list, list item, code block, rule, emoji, mention, status, date or card | `data-*` named as HTML's `dataset` names it: `<p data-local-id="a1f3">` |
| any other node, or a node holding what its element cannot | `<div class="adf-carry" data-adf="{…}"><p>its content</p></div>`, a `<span>` inline | | any other node, or a node holding what its element cannot, except an inline card a link marks, which is refused | `<div class="adf-carry" data-adf="{…}"><p>its content</p></div>`, a `<span>` inline |
- Every URL is written as the ADF holds it, `javascript:` included: a link's, an image's, a - Every URL is written as the ADF holds it, `javascript:` included: a link's, an image's, a
card's, and a carried link's in the carry element. Sanitize the HTML before showing a document from card's, and a carried link's in the carry element. Sanitize the HTML before showing a document from
+9 -4
View File
@@ -441,10 +441,15 @@ it joins the second panel's `<a>` to that portable spelling.
Inside a carry element, a card a link marks links to the link's target, and shows its own URL as its Inside a carry element, a card a link marks links to the link's target, and shows its own URL as its
text where it has one, so both stay. A card showing only its name keeps its URL in `data-adf` alone. text where it has one, so both stay. A card showing only its name keeps its URL in `data-adf` alone.
Atlassian's schema gives no card a link mark, so only a hand-built document meets this, and Recorded 2026-10-24 without a panel of its own: it puts the second panel's `<a>` around the text a
`adfToHtml` refuses such a card among the inline nodes it writes as `unsupported-node-shape`: no card shows.
element holds both its link and the card's own. Inside a carried block it shows as above, since a
carried node's JSON is not checked, and `htmlToAdf` still reads a carry element holding one, as it checks no carried JSON against the schema. Recorded 2026-10-24 without a panel of its own: it puts the second panel's `<a>` around the text a card shows. Atlassian's schema gives no card a link mark, so only a hand-built document holds one. HTML nests no
`<a>` in an `<a>`, so no element can hold both the link's target and the card's URL: `adfToHtml`
refuses such a card as `unsupported-node-shape` wherever it writes the card as its own element. The
maintainer chose this on 2026-11-04 over a new spelling. Inside a carry element the card shows as
above, since `adfToHtml` checks no carried node's JSON against the schema, and `htmlToAdf` still
reads a carry element holding one for the same reason.
A fifth panel (2026-11-04, three readers in the same roles, then four more for what the first three A fifth panel (2026-11-04, three readers in the same roles, then four more for what the first three
split on) was asked how to write a mention, emoji, status, date and inline card, which until then split on) was asked how to write a mention, emoji, status, date and inline card, which until then
+4 -4
View File
@@ -94,7 +94,7 @@ later release writes it as its own element.
- A hard break is `<br>`, and so is a line feed in text outside a `<div>`'s code block. - A hard break is `<br>`, and so is a line feed in text outside a `<div>`'s code block.
- Text a link marks is `<a href="…" title="…">` around it, or the text alone where HTML cannot - Text a link marks is `<a href="…" title="…">` around it, or the text alone where HTML cannot
hold the link's `href` or `title`; a `title` that is no string is left out. A card is a link to hold the link's `href` or `title`; a `title` that is no string is left out. A card is a link to
its URL; inside a carry element, to the target of a link marking it. the target of a link marking it, else to its URL.
- An external image with no link to another target is a link to its URL. An image marked by a - An external image with no link to another target is a link to its URL. An image marked by a
link to another target shows as portable markdown writes it inline. First comes the link, link to another target shows as portable markdown writes it inline. First comes the link,
around the image's `alt`, else the link's target, else the image's URL. Then comes ` (image)`, around the image's `alt`, else the link's target, else the image's URL. Then comes ` (image)`,
@@ -107,7 +107,9 @@ later release writes it as its own element.
- Characters HTML cannot hold are dropped. - Characters HTML cannot hold are dropped.
- A node rides the carry where it holds a mark or a key its element does not write, an attribute - A node rides the carry where it holds a mark or a key its element does not write, an attribute
its type does not hold as that kind, an empty `attrs`, `content` or `marks`, or a value its its type does not hold as that kind, an empty `attrs`, `content` or `marks`, or a value its
element cannot hold: element cannot hold. The exception is an inline card a link marks, which `adfToHtml` refuses as
`unsupported-node-shape`: Atlassian's schema gives a card no link mark, and HTML nests no link in
a link.
- text holding no character, or a character HTML cannot hold; text holding a mark twice, or a - text holding no character, or a character HTML cannot hold; text holding a mark twice, or a
mark with attributes besides a link's `href` and `title`; mark with attributes besides a link's `href` and `title`;
- an unmarked text node straight after one written as plain text, which would read back as one; - an unmarked text node straight after one written as plain text, which would read back as one;
@@ -155,8 +157,6 @@ that node in either spelling: an edit there would be lost, so it is `unmappable-
is not the day its `data-timestamp` names, a card without `data-data` whose `href` and text are is not the day its `data-timestamp` names, a card without `data-data` whose `href` and text are
not one URL, and a card with `data-data` whose `href` is not the URL its `data` holds or whose not one URL, and a card with `data-data` whose `href` is not the URL its `data` holds or whose
text is not its name, else that URL, are `unmappable-html`. text is not its name, else that URL, are `unmappable-html`.
- `adfToHtml` refuses an inline card a link marks, which Atlassian's schema gives no link mark, as
`unsupported-node-shape`.
- A `data-*` attribute that its element does not take, such as `data-level` on `<h1>`, or that holds - A `data-*` attribute that its element does not take, such as `data-level` on `<h1>`, or that holds
a value outside its attribute's kind or not written as compact JSON, is `unsupported-node-shape`. a value outside its attribute's kind or not written as compact JSON, is `unsupported-node-shape`.
- A carry element's `data-adf` holding invalid JSON is `unmappable-html`. JSON that is no ADF node, - A carry element's `data-adf` holding invalid JSON is `unmappable-html`. JSON that is no ADF node,
+1 -1
View File
@@ -282,7 +282,7 @@ test('links a card a link marks, inside a carried node, to that link\'s target a
assert.equal(shown(html(adfToHtml(document({ content: [paragraph(card)], type: 'panel' })))), '<p><a href="https://example.com/">https://example.com/roadmap</a></p>') assert.equal(shown(html(adfToHtml(document({ content: [paragraph(card)], type: 'panel' })))), '<p><a href="https://example.com/">https://example.com/roadmap</a></p>')
}) })
test('refuses an inline card a link marks, which ADF\'s schema gives no link mark', () => { test('refuses an inline card a link marks, which Atlassian\'s schema does not allow', () => {
const marks: AdfMark[] = [{ attrs: { href: 'https://example.com/' }, type: 'link' }] const marks: AdfMark[] = [{ attrs: { href: 'https://example.com/' }, type: 'link' }]
const cards: AdfNode[] = [{ attrs: { url: 'https://example.com/roadmap' }, marks, type: 'inlineCard' }, { attrs: { data: { name: 'Roadmap', url: 'https://example.com/roadmap' } }, marks, type: 'inlineCard' }] const cards: AdfNode[] = [{ attrs: { url: 'https://example.com/roadmap' }, marks, type: 'inlineCard' }, { attrs: { data: { name: 'Roadmap', url: 'https://example.com/roadmap' } }, marks, type: 'inlineCard' }]
for (const card of cards) { for (const card of cards) {