From 153808358a574e61c3a11b43f5e7ddac11795fcb Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 16 Sep 2026 22:34:12 +0200 Subject: [PATCH] 13a - rule's color, style and weight and layoutSection's columnRuleStyle join the tables --- corpus/round-trip/block-nodes/commonmark-blocks.json | 8 ++++++++ corpus/round-trip/block-nodes/commonmark-blocks.md | 2 ++ corpus/round-trip/block-nodes/layout.json | 1 + corpus/round-trip/block-nodes/layout.md | 2 +- spec/flavour.md | 6 ++++-- src/adf-schema.test.ts | 2 +- src/adf/block-directives.ts | 4 ++-- 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/corpus/round-trip/block-nodes/commonmark-blocks.json b/corpus/round-trip/block-nodes/commonmark-blocks.json index 98b4515..18df01f 100644 --- a/corpus/round-trip/block-nodes/commonmark-blocks.json +++ b/corpus/round-trip/block-nodes/commonmark-blocks.json @@ -133,6 +133,14 @@ }, "type": "rule" }, + { + "attrs": { + "color": "#ff5630", + "style": "dashed", + "weight": 2 + }, + "type": "rule" + }, { "attrs": { "localId": "01a0431d-201a-7a65-bea7-84b441c85bd6" diff --git a/corpus/round-trip/block-nodes/commonmark-blocks.md b/corpus/round-trip/block-nodes/commonmark-blocks.md index 53d8fe8..9b47c80 100644 --- a/corpus/round-trip/block-nodes/commonmark-blocks.md +++ b/corpus/round-trip/block-nodes/commonmark-blocks.md @@ -31,5 +31,7 @@ Loosen the clamp !adf:rule {localId=01a0431d-2019-76b7-bf6f-13841363b111} +!adf:rule {color="#ff5630" style=dashed weight=2} + !adf:paragraph {localId=01a0431d-201a-7a65-bea7-84b441c85bd6} !adf:/paragraph diff --git a/corpus/round-trip/block-nodes/layout.json b/corpus/round-trip/block-nodes/layout.json index 8405400..37802f7 100644 --- a/corpus/round-trip/block-nodes/layout.json +++ b/corpus/round-trip/block-nodes/layout.json @@ -2,6 +2,7 @@ "content": [ { "attrs": { + "columnRuleStyle": "solid", "localId": "01a033cc-4b60-7b5e-85f4-34f27f039e9a" }, "content": [ diff --git a/corpus/round-trip/block-nodes/layout.md b/corpus/round-trip/block-nodes/layout.md index 44ff21f..3317aae 100644 --- a/corpus/round-trip/block-nodes/layout.md +++ b/corpus/round-trip/block-nodes/layout.md @@ -1,4 +1,4 @@ -!adf:layoutSection {localId=01a033cc-4b60-7b5e-85f4-34f27f039e9a} +!adf:layoutSection {columnRuleStyle=solid localId=01a033cc-4b60-7b5e-85f4-34f27f039e9a} !adf:layoutColumn {localId=01a03389-a5fb-747d-b418-e91f1b161e7f width=50} Left. !adf:/layoutColumn diff --git a/spec/flavour.md b/spec/flavour.md index 5328870..e3ad1ed 100644 --- a/spec/flavour.md +++ b/spec/flavour.md @@ -229,7 +229,8 @@ form. (number). `order` is the first marker, so a list carrying none, one that is no whole number from 0, or one whose markers would run past 999999999, has no CommonMark spelling. - `paragraph` — container, inline body. Attributes: `localId` (string). -- `rule` — leaf. Attributes: `localId` (string). +- `rule` — leaf. Attributes: `color` (string, `#rrggbb`), `localId` (string), `style` (`dashed` + `dotted` `fade` `sketch` `solid`), `weight` (number, 1–3). ```` !adf:codeBlock {localId=01a03d5c-9b21-73f4-8e6a-0c47b1d9e2f8 wrap=true} @@ -380,7 +381,8 @@ Ship it ### Layout -- `layoutSection` — container of `layoutColumn` containers. Attributes: `localId` (string). +- `layoutSection` — container of `layoutColumn` containers. Attributes: `columnRuleStyle` (`solid`), + `localId` (string). - `layoutColumn` — container, block body. Attributes: `localId` (string), `valign` (`bottom` `middle` `top`), `width` (number — percent). diff --git a/src/adf-schema.test.ts b/src/adf-schema.test.ts index de8eb89..4ab504d 100644 --- a/src/adf-schema.test.ts +++ b/src/adf-schema.test.ts @@ -18,7 +18,7 @@ type Spelled = [string, Map] const carried = ['alignment', 'annotation', 'backgroundColor', 'blockCard', 'bodiedRule', 'breakout', 'dataConsumer', 'embedCard', 'fontSize', 'fragment', 'indentation', 'inlineExtension', 'placeholder'] const definitionReference = '#/definitions/' -const gaps = ['layoutSection.columnRuleStyle', 'link.collection', 'link.id', 'link.occurrenceKey', 'rule.color', 'rule.style', 'rule.weight'] +const gaps = ['link.collection', 'link.id', 'link.occurrenceKey'] const grammarOwn = ['doc', 'text'] const readKeywords = ['$ref', 'additionalProperties', 'allOf', 'anyOf', 'enum', 'items', 'maxItems', 'maximum', 'minItems', 'minLength', 'minimum', 'pattern', 'properties', 'required', 'type'] const root = join(dirname(fileURLToPath(import.meta.url)), '..', 'spec', 'adf-schema') diff --git a/src/adf/block-directives.ts b/src/adf/block-directives.ts index 5b33d9e..20c10b2 100644 --- a/src/adf/block-directives.ts +++ b/src/adf/block-directives.ts @@ -59,7 +59,7 @@ export const blockDirectives = { extensionFrame: { attributes: {}, contentModel: 'block' }, heading: { attributes: { level: 'number', localId: 'string' }, contentModel: 'inline' }, layoutColumn: { attributes: { localId: 'string', valign: 'string', width: 'number' }, contentModel: 'block' }, - layoutSection: { attributes: localIdAttributes, contentModel: 'block' }, + layoutSection: { attributes: { columnRuleStyle: 'string', localId: 'string' }, contentModel: 'block' }, listItem: { attributes: localIdAttributes, contentModel: 'block' }, media: { attributes: mediaAttributes, contentModel: 'none' }, mediaGroup: { attributes: {}, contentModel: 'block' }, @@ -72,7 +72,7 @@ export const blockDirectives = { contentModel: 'block', }, paragraph: { attributes: localIdAttributes, contentModel: 'inline' }, - rule: { attributes: localIdAttributes, contentModel: 'none' }, + rule: { attributes: { color: 'string', localId: 'string', style: 'string', weight: 'number' }, contentModel: 'none' }, syncBlock: { attributes: syncBlockAttributes, contentModel: 'none' }, table: { attributes: { displayMode: 'string', isNumberColumnEnabled: 'boolean', layout: 'string', localId: 'string', width: 'number' }, contentModel: 'block' }, tableCell: { attributes: cellAttributes, contentModel: 'block' }, -- 2.52.0