@adobe/helix-md2jcr 1.1.36 → 1.1.38

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.1.38](https://github.com/adobe/helix-md2jcr/compare/v1.1.37...v1.1.38) (2025-10-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * table support ([#157](https://github.com/adobe/helix-md2jcr/issues/157)) ([1815a04](https://github.com/adobe/helix-md2jcr/commit/1815a043a0ed2ae8fbb8c07b007f6354e0ab9edb))
7
+
8
+ ## [1.1.37](https://github.com/adobe/helix-md2jcr/compare/v1.1.36...v1.1.37) (2025-09-29)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#156](https://github.com/adobe/helix-md2jcr/issues/156)) ([f8e02a1](https://github.com/adobe/helix-md2jcr/commit/f8e02a127844605f6438623cc001655e40421d20))
14
+
1
15
  ## [1.1.36](https://github.com/adobe/helix-md2jcr/compare/v1.1.35...v1.1.36) (2025-09-29)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-md2jcr",
3
- "version": "1.1.36",
3
+ "version": "1.1.38",
4
4
  "description": "Helix Service that converts markdown to JCR content structure",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "image-size": "2.0.2",
42
42
  "mdast-util-to-hast": "^13.2.0",
43
43
  "mdast-util-to-string": "^4.0.0",
44
- "mime": "4.0.7",
44
+ "mime": "4.1.0",
45
45
  "rehype-parse": "9.0.1",
46
46
  "remark-gfm": "4.0.1",
47
47
  "remark-parse": "11.0.0",
@@ -74,7 +74,7 @@
74
74
  "mocha": "11.7.2",
75
75
  "mocha-multi-reporters": "1.5.1",
76
76
  "nock": "13.5.6",
77
- "semantic-release": "24.2.7",
77
+ "semantic-release": "24.2.8",
78
78
  "unist-util-inspect": "8.1.0",
79
79
  "yauzl": "3.2.0"
80
80
  },
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { getComponentById, getComponentByTitle } from './Definitions.js';
13
+ import { getComponentById, getComponentByTitle, getAllComponents } from './Definitions.js';
14
14
  import FieldGroup from './FieldGroup.js';
15
15
 
16
16
  /**
@@ -99,6 +99,18 @@ class ModelHelper {
99
99
  this.groups.push({ modelId: filtersModel.id, fieldGroup: new FieldGroup(filtersModel) });
100
100
  });
101
101
  }
102
+
103
+ // // special case for the table component where the component is dynamically selected
104
+ // // therefore we are going to add all the models that start with 'table-col-'
105
+ // // so that we can find the associated model for each column.
106
+ if (component.name.toLowerCase() === 'table') {
107
+ // add all the models that start with 'table-col-'
108
+ this.models.forEach((m) => {
109
+ if (m.id.startsWith('table-col-')) {
110
+ this.groups.push({ modelId: m.id, fieldGroup: new FieldGroup(m) });
111
+ }
112
+ });
113
+ }
102
114
  }
103
115
 
104
116
  /**
@@ -112,6 +124,27 @@ class ModelHelper {
112
124
  // no need to pass the fieldGroup just return the fields in the group
113
125
  return (result) ? result.fieldGroup : null;
114
126
  }
127
+
128
+ /**
129
+ * Return the allowed components for the component.
130
+ * @param {Component} component The component.
131
+ * @return {Array<string>} The allowed components.
132
+ */
133
+ getAllowedComponents(component) {
134
+ const base = this.filters.find((f) => f.id === component.filterId)?.components || [];
135
+
136
+ // special case for the table component where the component is dynamically selected
137
+ // therefore we are going to add all the models that start with 'table-col-'
138
+ // so that we can find the associated model for each column.
139
+ if (component.name.toLowerCase() === 'table') {
140
+ const components = getAllComponents(this.definition);
141
+ components
142
+ .filter((c) => c.id.startsWith('table-col-'))
143
+ .forEach((c) => base.push(c.id));
144
+ }
145
+
146
+ return base;
147
+ }
115
148
  }
116
149
 
117
150
  export default ModelHelper;
@@ -549,7 +549,8 @@ function gridTablePartial(context) {
549
549
  // 1. In this section attempt to locate the associated model for the block.
550
550
  // 2. Trim the mdast nodes to only be relevant for the child block.
551
551
  // 3. Then getBlockitems will process the mdast nodes and return the block items.
552
- const allowedComponents = filters.find((f) => f.id === component.filterId)?.components || [];
552
+ const allowedComponents = modelHelper.getAllowedComponents(component);
553
+
553
554
  // collect all rows
554
555
  const blockRows = findAll(mdast, (node) => node.type === 'gtRow', true);
555
556
  // the fieldGroup (parent model) determines the expected number of rows in the table