mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-21 07:32:58 +01:00
Write mentions and inline cards holding data as HTML elements, not the carry
This commit is contained in:
+6
-5
@@ -9,17 +9,18 @@
|
||||
libraries and Atlassian's own paths.
|
||||
- `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, status, date and card
|
||||
holding a URL and no `data` are `<span class="adf-emoji">`, `<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, status, date or card writes its other attributes as `data-*`
|
||||
`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">`,
|
||||
`<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.
|
||||
- `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 or status's text becomes its `text`; an edit to a date's or a
|
||||
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`
|
||||
|
||||
Reference in New Issue
Block a user