@adobe/helix-md2jcr 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +5 -0
- package/docs/block-options.md +3 -2
- package/docs/phrasing.md +54 -0
- package/docs/section-styles.md +65 -0
- package/docs/superpowers/plans/2026-06-08-section-style-grouping.md +969 -0
- package/package.json +1 -1
- package/src/mdast2jcr/domain/GroupOptions.js +112 -0
- package/src/mdast2jcr/domain/Models.js +18 -4
- package/src/mdast2jcr/hb/helpers/section-helper.js +23 -0
- package/src/mdast2jcr/hb/partials/grid-table.js +6 -88
- package/src/mdast2jcr/hb/partials/paragraph.js +2 -1
- package/src/mdast2jcr/hb/partials/supports/hast-handlers.js +40 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [1.5.0](https://github.com/adobe/helix-md2jcr/compare/v1.4.1...v1.5.0) (2026-06-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **phrasing:** preserve inline HTML tags in text elements ([#217](https://github.com/adobe/helix-md2jcr/issues/217)) ([5f7d274](https://github.com/adobe/helix-md2jcr/commit/5f7d2745005ae0947866fb66989cdb9626cb3e60))
|
|
7
|
+
|
|
8
|
+
## [1.4.1](https://github.com/adobe/helix-md2jcr/compare/v1.4.0...v1.4.1) (2026-06-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* republish after npm provenance failures ([c078b3f](https://github.com/adobe/helix-md2jcr/commit/c078b3f68de461213347339cc6afd3de1c3cfcd7))
|
|
14
|
+
|
|
15
|
+
# [1.4.0](https://github.com/adobe/helix-md2jcr/compare/v1.3.0...v1.4.0) (2026-06-09)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **section-metadata:** element grouping for section style + classes in modelFields ([#216](https://github.com/adobe/helix-md2jcr/issues/216)) ([861bf48](https://github.com/adobe/helix-md2jcr/commit/861bf481d623e74045a81de2a80bbc0af6a31db1)), closes [#215](https://github.com/adobe/helix-md2jcr/issues/215)
|
|
21
|
+
|
|
1
22
|
# [1.3.0](https://github.com/adobe/helix-md2jcr/compare/v1.2.21...v1.3.0) (2026-06-08)
|
|
2
23
|
|
|
3
24
|
|
package/README.md
CHANGED
|
@@ -109,8 +109,13 @@ console.log(xml);
|
|
|
109
109
|
- [Block Options (Classes)](docs/block-options.md) — block option classes and
|
|
110
110
|
element grouping (`classes`, `classes_*`): how header options are routed to
|
|
111
111
|
fields by their options or boolean name-suffix.
|
|
112
|
+
- [Section Styles](docs/section-styles.md) — element grouping for a section's
|
|
113
|
+
`style` group (`style`, `style_*`): how the single Section Metadata `style`
|
|
114
|
+
cell is routed back to fields, mirroring block options.
|
|
112
115
|
- [Field Hinting](docs/field-hinting.md) — using `<!-- field: name -->` to skip
|
|
113
116
|
ahead within a field group.
|
|
117
|
+
- [Phrasing Content](docs/phrasing.md) — supported inline HTML tags (`sup`, `sub`,
|
|
118
|
+
`u`, `del`, `strong`, `em`) and how they survive the markdown → JCR pipeline.
|
|
114
119
|
|
|
115
120
|
## Baseline XML Files
|
|
116
121
|
Running the ./baseline-tests.sh script will detect any md file under test/fixtures and execute the convert2jcr node script.
|
package/docs/block-options.md
CHANGED
|
@@ -76,8 +76,9 @@ Promo (highlight, featured, sticky) // classes is free-form, classes_sticky is
|
|
|
76
76
|
-> classes="[highlight, featured]" classes_sticky="true"
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
The classes group fields are block options, not content, so they
|
|
80
|
-
|
|
79
|
+
The classes group fields are block options, not content, so they never consume
|
|
80
|
+
content rows. They are still listed in `modelFields` so the Universal Editor can
|
|
81
|
+
render their option controls.
|
|
81
82
|
|
|
82
83
|
## Requirements
|
|
83
84
|
|
package/docs/phrasing.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Phrasing Content (Inline HTML)
|
|
2
|
+
|
|
3
|
+
Phrasing content refers to inline elements that flow within a line of text — as
|
|
4
|
+
opposed to block-level elements like paragraphs, headings, and lists.
|
|
5
|
+
|
|
6
|
+
When raw HTML inline tags appear in markdown source, remark parses them as `html`
|
|
7
|
+
nodes. The `mdast-sanitize-html` step converts them into typed mdast nodes, and
|
|
8
|
+
the serializer then maps those nodes back to their HTML equivalents when writing
|
|
9
|
+
the `text` attribute of a JCR text component.
|
|
10
|
+
|
|
11
|
+
## Supported Tags
|
|
12
|
+
|
|
13
|
+
| HTML tag | mdast node type | Serializes to |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| `<sup>` | `superscript` | `<sup>` |
|
|
16
|
+
| `<sub>` | `subscript` | `<sub>` |
|
|
17
|
+
| `<u>` | `underline` | `<u>` |
|
|
18
|
+
| `<del>` | `delete` | `<del>` |
|
|
19
|
+
| `<strong>` | `strong` | `<strong>` |
|
|
20
|
+
| `<em>` | `emphasis` | `<em>` |
|
|
21
|
+
|
|
22
|
+
`superscript`, `subscript`, and `underline` are custom node types introduced by
|
|
23
|
+
`mdast-sanitize-html`. They require explicit handlers in `hast-handlers.js` so
|
|
24
|
+
that `mdast-util-to-hast` knows to emit the correct tag rather than falling back
|
|
25
|
+
to `<div>`. The remaining three (`delete`, `strong`, `emphasis`) are standard
|
|
26
|
+
mdast types with built-in hast handlers.
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
Markdown source:
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
E = mc<sup>2</sup> and H<sub>2</sub>O with <u>underline</u>, <del>strike</del>, <strong>bold</strong>, <em>italic</em>.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Resulting `text` attribute value:
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<p>E = mc<sup>2</sup> and H<sub>2</sub>O with <u>underline</u>, <del>strike</del>, <strong>bold</strong>, <em>italic</em>.</p>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Pipeline
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
markdown source
|
|
46
|
+
→ remark parse → html nodes (raw inline HTML)
|
|
47
|
+
→ mdast-sanitize-html → typed mdast nodes (superscript, subscript, etc.)
|
|
48
|
+
→ toHast (with customHastHandlers) → hast element nodes
|
|
49
|
+
→ toHtml → HTML string stored in JCR text attribute
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The custom handlers live in
|
|
53
|
+
`src/mdast2jcr/hb/partials/supports/hast-handlers.js` and are applied wherever
|
|
54
|
+
`toHast` is called — currently `paragraph.js` and `grid-table.js`.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Section Styles (Element Grouping for `style`)
|
|
2
|
+
|
|
3
|
+
A section's appearance is controlled by the **Style** property of its Section
|
|
4
|
+
Metadata, which AEM turns into CSS classes on the containing section element.
|
|
5
|
+
`style` is the section counterpart of a block's [`classes`](./block-options.md)
|
|
6
|
+
property.
|
|
7
|
+
|
|
8
|
+
When a section model exposes several style options — especially mutually
|
|
9
|
+
exclusive ones — it can use the
|
|
10
|
+
[element grouping](https://www.aem.live/developer/component-model-definitions#element-grouping-for-block-options)
|
|
11
|
+
naming convention: a **style group** is the base `style` field plus any
|
|
12
|
+
`style_<name>` field.
|
|
13
|
+
|
|
14
|
+
```jsonc
|
|
15
|
+
{ "component": "select", "name": "style", "options": [ "variant-a", "variant-b" ] }
|
|
16
|
+
{ "component": "multiselect", "name": "style_background", "options": [ "light", "dark" ] }
|
|
17
|
+
{ "component": "boolean", "name": "style_fullwidth" }
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
AEM collapses the whole style group into the single, well-known `style` cell of
|
|
21
|
+
the Section Metadata table (a flat, comma-separated list). Going from markdown to
|
|
22
|
+
JCR, md2jcr routes each token back to its field — exactly as it does for block
|
|
23
|
+
`classes`:
|
|
24
|
+
|
|
25
|
+
- **boolean field** — matched by its name suffix (after `style_`); token
|
|
26
|
+
`fullwidth` sets `style_fullwidth="true"`, absent leaves it unset;
|
|
27
|
+
- **select / multiselect field** — matched by its declared option values; a
|
|
28
|
+
multiselect claims all of its matching tokens (`style_background="[light, dark]"`);
|
|
29
|
+
- **base `style` field** — receives any leftover tokens (also the common single,
|
|
30
|
+
free-form `style` field case).
|
|
31
|
+
|
|
32
|
+
### Example
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
+-------------------------------------------------------+
|
|
36
|
+
| Section Metadata |
|
|
37
|
+
+================+======================================+
|
|
38
|
+
| style | variant-a, light, fullwidth |
|
|
39
|
+
+----------------+--------------------------------------+
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
becomes:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
style="variant-a" style_background="light" style_fullwidth="true"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Notes
|
|
49
|
+
|
|
50
|
+
- The routing rules and the underlying implementation are shared with block
|
|
51
|
+
options — see [Block Options](./block-options.md).
|
|
52
|
+
- Distribution only kicks in when the section model declares at least one
|
|
53
|
+
`style_<name>` field. A model with only a base `style` field keeps the simple
|
|
54
|
+
one-to-one mapping.
|
|
55
|
+
- The `style` group is listed in `modelFields` so the Universal Editor can
|
|
56
|
+
render those fields — the same as a block's `classes` group.
|
|
57
|
+
|
|
58
|
+
### Worked fixtures
|
|
59
|
+
|
|
60
|
+
See [`test/fixtures/blocks/core/section-style-options`](../test/fixtures/blocks/core/section-style-options):
|
|
61
|
+
|
|
62
|
+
- `section-style-grouping` — single selects + a boolean that is on
|
|
63
|
+
- `section-style-grouping-multi` — a multiselect claiming several values, boolean off
|
|
64
|
+
- `section-style-grouping-fallback` — free-form base `style` catch-all + a boolean
|
|
65
|
+
- `section-style-grouping-booleans` — several independent boolean options, mixed on/off
|