mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-12 11:48:29 +01:00
Answer product-owner round 1: 0 🔴, 1 🟡 (0 misread); describe a data card as adfToHtml writes it
This commit is contained in:
+9
-8
@@ -10,19 +10,20 @@
|
||||
- `adfToHtml` writes ADF as HTML: paragraphs, headings, lists, quotes, code blocks, rules, hard
|
||||
breaks, a centered, uncaptioned external image holding no attribute but its URL and alt, and
|
||||
`em`, `strong`, `code` and links as their elements. An unmarked emoji, mention, status, date
|
||||
and card holding a URL or `data`, not both, are `<span class="adf-emoji">`,
|
||||
and card holding a URL, or `data` holding one, not both, are `<span class="adf-emoji">`,
|
||||
`<span class="adf-mention">`, `<span class="adf-status">`, `<time class="adf-date">` and
|
||||
`<a class="adf-inline-card">`. A paragraph, heading, quote, list, list item, code block, rule,
|
||||
emoji, mention, status, date or card writes its other attributes as `data-*`
|
||||
attributes, `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 ADF holds it,
|
||||
`javascript:` included: sanitize HTML from an author you do not trust before showing it.
|
||||
emoji, mention, status, date or card writes its other attributes as `data-*` attributes,
|
||||
`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
|
||||
ADF holds it, `javascript:` included: sanitize HTML from an author you do not trust before
|
||||
showing it.
|
||||
- `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,
|
||||
` `, a raw `<` or `>` in an attribute value) and as a form post sends it (`\r\n` for each
|
||||
line feed). An edit to an emoji's, mention's or status's text becomes its `text`; an edit to a date's or a
|
||||
card's text alone is refused. It refuses any other HTML, including an edit to what a carry element
|
||||
shows, with the codes README §The calls lists.
|
||||
line feed). An edit to an emoji's, mention's or status's text becomes its `text`; an edit to a
|
||||
date's or a card's text alone is refused. It refuses any other HTML, including an edit to what a
|
||||
carry element shows, with the codes README §The calls lists.
|
||||
- **Breaking:** `losslessMarkdownToAdf` gives a `date`, `emoji`, `inlineCard`, `mention`, `status`
|
||||
or `mediaInline` only the marks Atlassian's schema lets it hold: `**!adf:mention[@A]{id=…}**` now
|
||||
reads as a plain mention. A link or directive mark around only nodes that cannot take it is
|
||||
|
||||
@@ -519,7 +519,7 @@ content. No stylesheet ships. The complete dialect:
|
||||
| `date`, `emoji`, `mention`, `status` | `<time class="adf-date" datetime="2025-08-25" data-timestamp="…">2025-08-25</time>`, `<span class="adf-emoji" data-id="1f389" data-short-name=":tada:">🎉</span>`, `<span class="adf-mention" data-id="5b10a2">@Mikael</span>`, `<span class="adf-status" data-color="yellow">In review</span>` |
|
||||
| `hardBreak` | `<br>` |
|
||||
| `heading` | `<h1>` to `<h6>` |
|
||||
| `inlineCard` holding a `url`, or `data` and no `url` | `<a class="adf-inline-card" href="…">…</a>`; for `data`, `href` is the URL it holds, the text its name, and `data-data` the rest |
|
||||
| `inlineCard` holding a `url`, or `data` and no `url` | `<a class="adf-inline-card" href="…">…</a>`; for `data`, `href` is the URL `data` holds, the text its name, else that URL, and `data-data` the whole `data` as JSON |
|
||||
| `link` | `<a href="…" title="…">` |
|
||||
| `mediaSingle` holding an external `media`, centered, uncaptioned, holding no other attribute such as `width` or `localId` | `<p><img src="…" alt="…"></p>`, the image inside `<a>` where a link marks it; an image holding such an attribute, as editor-written ones do, rides the carry element |
|
||||
| `paragraph` | `<p>` |
|
||||
@@ -535,9 +535,9 @@ content. No stylesheet ships. The complete dialect:
|
||||
hold, such as a carriage return or a control character, rides the carry element.
|
||||
- In a `<div>`, the carry element shows each block's content as a `<p>`, and a code block's as
|
||||
`<pre><code>` keeping its indentation; in a `<span>`, it parts blocks with `<br>`. It shows text a
|
||||
link marks as a link, a mention, status or emoji by its text, a date as `2026-09-13` in UTC, a
|
||||
card as a link to its URL, or to the target of a link marking it, an external image as a link to
|
||||
it, a stored one by its `alt`, and an expand by its title. An image marked by a link to another
|
||||
link marks as a link, a status or emoji by its text, a mention by its text, else `@` and its id,
|
||||
a date as `2026-09-13` in UTC, a card as a link to its URL, or to the target of a link marking
|
||||
it, an external image as a link to it, a stored one by its `alt`, and an expand by its title. An image marked by a link to another
|
||||
target shows that link, then `(image)` linking to the image. A node it cannot show leaves a note
|
||||
instead, such as `<em>(image)</em>`; a link marking the node goes around the note.
|
||||
|
||||
|
||||
+6
-4
@@ -117,8 +117,10 @@ later release writes it as its own element.
|
||||
non-empty `alt`;
|
||||
- a heading whose `level` is not 1 to 6, and an ordered list whose `order` is not a safe integer
|
||||
or is `-0`;
|
||||
- an emoji, mention or status with no `text`, a date whose `timestamp` names no day from year 1
|
||||
to 9999, a card holding neither a `url` nor `data` with a URL, and a card holding both;
|
||||
- an emoji, mention or status with no `text`, and a date whose `timestamp` names no day from year
|
||||
1 to 9999;
|
||||
- a card holding an empty `url`, both a `url` and `data`, or neither, and one holding `data`
|
||||
alone whose `url` is missing or holds only whitespace;
|
||||
- a code block holding more than one text node, a marked one, or a language holding ASCII
|
||||
whitespace;
|
||||
- a rule or hard break holding `content`, and a hard break holding an attribute;
|
||||
@@ -151,8 +153,8 @@ that node in either spelling: an edit there would be lost, so it is `unmappable-
|
||||
non-empty HTML not ending in a line feed.
|
||||
- An emoji, mention, status, date or card element with empty text, a date whose `datetime` or text
|
||||
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 it whose `href` and text are not the URL and name its `data` holds,
|
||||
are `unmappable-html`.
|
||||
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`.
|
||||
- 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 carry element's `data-adf` holding invalid JSON is `unmappable-html`. JSON that is no ADF node,
|
||||
|
||||
Reference in New Issue
Block a user