3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-18 06:05:43 +01:00

Write media, colours, alignment, panels, expands and task lists as HTML in adfToHtml and read them back in htmlToAdf

This commit is contained in:
2026-11-15 00:03:44 +01:00
committed by Lillem4n
parent 4f81a65254
commit f5c8a48706
24 changed files with 1062 additions and 123 deletions
+20 -3
View File
@@ -420,7 +420,7 @@ for HTML+, its Rovo MCP server's HTML for agents; a published spec reopens the g
The HTML dialect mirrors the markdown flavour: semantic elements, stable `adf-*` classes, `data-*`
for what HTML cannot express, text always escaped. No stylesheet ships.
The spellings, `spec/html.md`, are seven writer panels' (2026-10-23, -24, 2026-11-04, -05 and -14), each of a
The spellings, `spec/html.md`, are eight writer panels' (2026-10-23, -24, 2026-11-04, -05 and -14), each of a
product manager, an engineer and a support agent. The first picked each of these 3 of 3:
- an image standing alone as `<p><img …></p>`, over `<figure>` and a bare `<img>`;
@@ -495,6 +495,23 @@ table is a section per corpus example, led by a summary table expected `<s>` or
`text-decoration:line-through`. They chose `<del>` because its name says the text is removed, and
GFM's renderers write `<del>` for `~~`.
An eighth panel (2026-11-14, three readers in the same roles; seven for indentation) picked, 3 of 3:
- a `mediaSingle` as `<figure class="adf-media-single" data-*>` holding an `<img>`, inside `<a>` where
a link marks it, and a `<figcaption>`; a `mediaGroup` as `<div class="adf-media-group">` holding a
`<span class="adf-file" data-*>` for each file;
- `<u>`, `<sub>` and `<sup>`, `<span style="color:…">` and `<mark style="background-color:…">`;
- `style="text-align:center"` and `text-align:right` for an `alignment` of `center` and `end`;
- `<details class="adf-expand">` and `<details class="adf-nested-expand">` with the `title` as the
`<summary>` and `<div class="adf-panel" data-panel-type="…">`;
- a task list as `<ul class="adf-task-list">` of `<li class="adf-task" data-state="DONE">` holding
`<input type="checkbox" checked="" disabled="">` and the text, a decision list the same with
`adf-decision-list`, `adf-decision` and no checkbox. `checked=""` and `disabled=""` are spelled with
a value because the attribute grammar has no bare attribute.
For an `indentation` mark, five of seven picked `data-indent-level`; whether a `margin-left` style
goes with it split 4 to 3, so it rides the carry until `todo.md` item 184 is answered.
## `htmlToAdf` also reads the dialect as a browser serializes it
2026-10-28, the maintainer. Goal 6. Valid while a viewer/editor app may show `adfToHtml`'s HTML in a
@@ -1298,8 +1315,8 @@ the copy is refused as `unmappable-html` rather than saved. They expected:
- The `strike` mark in Emphasis and strikethrough as `<s>relay</s>` or `<del>relay</del>`, which
`adfToHtml` writes as `<del>` (§The HTML dialect).
`todo.md` item 134 will write the rest; its writer panel picks the spelling with these
expectations as input. The Date row drew 1 of 3 not reasonable, so four more readers (bot,
The writer panel of §The HTML dialect picked the rest of the spellings with these
expectations as input; `blockTaskItem` and a nested task list ride the carry. The Date row drew 1 of 3 not reasonable, so four more readers (bot,
reader of the markdown, export/indexing, viewer/editor) read it, and 5 of 7 found it reasonable.
`adfToLosslessMarkdown` keeps writing `!adf:date{timestamp=1756080000000}`. The two who rejected
it wanted the day shown, as `!adf:date[2025-08-25]{timestamp=…}`.
+13 -4
View File
@@ -373,9 +373,15 @@ Weather permitting.
`adfToHtml`, round-trip holds:
```html
<div class="adf-carry" data-adf="{&quot;attrs&quot;:{&quot;panelType&quot;:&quot;warning&quot;},&quot;content&quot;:[{&quot;content&quot;:[{&quot;text&quot;:&quot;Check the collation before importing.&quot;,&quot;type&quot;:&quot;text&quot;}],&quot;type&quot;:&quot;paragraph&quot;}],&quot;type&quot;:&quot;panel&quot;}"><p>Check the collation before importing.</p></div>
<div class="adf-carry" data-adf="{&quot;attrs&quot;:{&quot;localId&quot;:&quot;01a0337c-561a-75aa-b629-3801f68839ad&quot;,&quot;panelType&quot;:&quot;info&quot;},&quot;content&quot;:[{&quot;content&quot;:[{&quot;text&quot;:&quot;Backups run at 02:00.&quot;,&quot;type&quot;:&quot;text&quot;}],&quot;type&quot;:&quot;paragraph&quot;}],&quot;type&quot;:&quot;panel&quot;}"><p>Backups run at 02:00.</p></div>
<div class="adf-carry" data-adf="{&quot;attrs&quot;:{&quot;panelColor&quot;:&quot;#c9372c&quot;,&quot;panelIcon&quot;:&quot;:rainbow:&quot;,&quot;panelIconId&quot;:&quot;1f308&quot;,&quot;panelIconText&quot;:&quot;🌈&quot;,&quot;panelType&quot;:&quot;custom&quot;},&quot;content&quot;:[{&quot;content&quot;:[{&quot;text&quot;:&quot;Weather permitting.&quot;,&quot;type&quot;:&quot;text&quot;}],&quot;type&quot;:&quot;paragraph&quot;}],&quot;type&quot;:&quot;panel&quot;}"><p>Weather permitting.</p></div>
<div class="adf-panel" data-panel-type="warning">
<p>Check the collation before importing.</p>
</div>
<div class="adf-panel" data-local-id="01a0337c-561a-75aa-b629-3801f68839ad" data-panel-type="info">
<p>Backups run at 02:00.</p>
</div>
<div class="adf-panel" data-panel-color="#c9372c" data-panel-icon=":rainbow:" data-panel-icon-id="1f308" data-panel-icon-text="🌈" data-panel-type="custom">
<p>Weather permitting.</p>
</div>
```
## Task list
@@ -588,5 +594,8 @@ The card below has no spelling yet.
```html
<div class="adf-carry" data-adf="{&quot;attrs&quot;:{&quot;url&quot;:&quot;https://example.com/roadmap&quot;},&quot;type&quot;:&quot;blockCard&quot;}"><p><a href="https://example.com/roadmap">https://example.com/roadmap</a></p></div>
<div class="adf-carry" data-adf="{&quot;attrs&quot;:{&quot;panelType&quot;:&quot;info&quot;},&quot;content&quot;:[{&quot;content&quot;:[{&quot;text&quot;:&quot;The card below has no spelling yet.&quot;,&quot;type&quot;:&quot;text&quot;}],&quot;type&quot;:&quot;paragraph&quot;},{&quot;attrs&quot;:{&quot;layout&quot;:&quot;wide&quot;,&quot;url&quot;:&quot;https://example.com/board&quot;,&quot;width&quot;:100},&quot;type&quot;:&quot;embedCard&quot;}],&quot;type&quot;:&quot;panel&quot;}"><p>The card below has no spelling yet.</p><p><a href="https://example.com/board">https://example.com/board</a></p></div>
<div class="adf-panel" data-panel-type="info">
<p>The card below has no spelling yet.</p>
<div class="adf-carry" data-adf="{&quot;attrs&quot;:{&quot;layout&quot;:&quot;wide&quot;,&quot;url&quot;:&quot;https://example.com/board&quot;,&quot;width&quot;:100},&quot;type&quot;:&quot;embedCard&quot;}"><p><a href="https://example.com/board">https://example.com/board</a></p></div>
</div>
```
+17
View File
@@ -1110,3 +1110,20 @@ Read most (opens and searches):
- `src/plain-text/adf-to-plain-text.ts` 2
- `CHANGELOG.md` 1
- `docker-runner.sh` 1
## Reading cost, chunk a559b3cc15ee, finished 2026-11-14T22:28:07Z
155854 new input tokens before the first commit.
Read most (opens and searches):
- `docs/decisions.md` 11
- `spec/html.md` 7
- `CHANGELOG.md` 6
- `README.md` 5
- `todo.md` 4
- `src/html/emit/adf-to-html.test.ts` 3
- `ci.sh` 2
- `src/html/parse/html-to-adf.test.ts` 2
- `.gitignore` 1
- `AGENTS.md` 1