mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-17 21:55:44 +01:00
5.8 KiB
5.8 KiB
Changelog
Unreleased
- Breaking: each call names the markdown it reads or writes.
adfToMarkdownandmarkdownToAdfare nowadfToLosslessMarkdownandlosslessMarkdownToAdf. A bot's or a model's markdown reads inportableMarkdownToAdf, and markdown known to be strict CommonMark in the newcommonMarkToAdf, where a directive, a pipe table,~~and anadf:fence read as text and code.MIGRATION.mdsays which call to take. - Breaking: the markdown readers refuse a value that is not a string with the new code
not-a-string;MIGRATION.mdlists what each value did before. - Breaking: an attribute value that is not a plain object, array or JSON primitive, such as a
Date,Map, typed array or class instance, makesisAdfDocumentreturnfalseand the converters refuse it asnot-an-adf-document. Before, the converters wrote it as{}or its own keys. Build it as JSON holds it:date.toISOString(),Object.fromEntries(map),Array.from(bytes),{ ...instance }. - The README opens with what the package does and for whom, and
package.jsoncarries search keywords. - The source moves to github.com/larvit/adf-codec, where issues and pull requests go.
- Breaking: directives, the inline opaque carry among them (now
!adf:carry{json="…"}), are spelled under an!adf:prefix (!adf:name … !adf:/name,!adf:name[content]{attrs},!adf:name arg {attrs}) in place of the:::/::/:nameforms: text holding an unescaped!adf:is claimed. Convert stored markdown perMIGRATION.md. - Breaking: the block carry is a code fence whose info string
adf:<type>names the node's type, its body the node's JSON withouttype, and a code fence whose info string opensadf:is claimed, andadfis an ordinary code block language. Convert stored markdown perMIGRATION.md. - Breaking: the markdown readers read markdown holding no block as a document whose
contentis empty, as Atlassian's schema requires;!adf:doc {content=none}spells a document holding nocontentkey. losslessMarkdownToAdf(adfToLosslessMarkdown(doc))deep-equalsdocasJSON.parsebuilds it: two adjacent text nodes CommonMark would read back as one are parted by!adf:textBreak{}, an emptyattrs,contentormarksis spelled{attrs=empty},{content=empty}or{marks=empty},-0is spelled-0, and acodeBlockof several text nodes is a fence per node. AcodeBlockholding other than plain text nodes rides the block carry, where it was refused.- Breaking:
unspellable-characterandunspellable-line-startleaveConvertErrorCode, andadfToLosslessMarkdownno longer returnsunspellable-whitespace. A carriage return in text is spelled and a null character!adf:text{text="\u0000"}; a paragraph line opening with a code span is spelled as that code span, its backticks opening no fence; a code block holding either character, a code span holding a null character, a text node holding no text or holdingcontent, and anemoji,mentionorstatuswhosetextholds a line ending or a null character ride the carry. SeeMIGRATION.md. - Fix a link
titleholding a null character: it is written as!adf:link[text]{attrs}, where it read back as U+FFFD. - Breaking:
unspellable-linkleavesConvertErrorCode; a link whosehrefortitleno CommonMark escape spells is written as!adf:link[text]{attrs}. - Breaking: some directive refusals carry
malformed-directivewhere they carriedunsupported-node-shape, and an empty node's leaf and closed spellings swap which one parses;MIGRATION.mdlists each. - Breaking: a link whose text holds another link keeps the inner link and leaves the outer
brackets literal text, where
0.1.0split the outer link around it; seeMIGRATION.md. - Add
adfToPortableMarkdownandportableMarkdownToAdf, a lossy pair converting ADF to and from markdown GitHub, GitLab and Obsidian render: alerts, callouts, task lists,==highlights==and pipe tables. - Spell
rule'scolor,styleandweight,layoutSection'scolumnRuleStyleand a link'scollection,idandoccurrenceKeydirectly where they rode the opaque carry. - Fix an image inside another image's description: it flattens into the alt text, where it was refused.
- Breaking:
unmappable-imageleavesConvertErrorCode, and every image reads. An image reads as an image only alone in its paragraph, and its title becomes the caption. Anywhere else it reads as its alt text linked to its URL; inside a link, as plain text the link marks. A link alone in its paragraph whose whole text is one image reads as that image, with the link marking it. To keep an image an image, give it a paragraph of its own. SeeMIGRATION.md. - Breaking: an empty link text reads as its destination,
[](/url)as/urllinked, and[]()as nothing, where both spellings stayed literal text. SeeMIGRATION.md. - Fix a JSON key holding an escape, in a carried node or a JSON attribute such as
parameters:losslessMarkdownToAdfreads it as the key it spells, where on V8 13.6 and later (Node 24, Deno, Chrome)markdownToAdfcould refuse markdownadfToMarkdownwrote, asunsupported-node-shape, once the process had read a key holding a backslash (V8 bug). - Fix a cyclic document, in which an object holds itself:
adfToLosslessMarkdownandadfToPortableMarkdownrefuse it asnot-an-adf-documentandisAdfDocumentreturnsfalse, where all three hung.
0.1.0
- First release: lossless conversion between ADF and an extended markdown flavour —
adfToMarkdown,markdownToAdfandisAdfDocument. Nothing throws, and every error carries acodefrom a closed list.