@uniweb/semantic-parser 1.1.8 → 1.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/semantic-parser",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Semantic parser for ProseMirror/TipTap content structures",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -364,17 +364,10 @@ function processGroupContent(elements) {
364
364
  break;
365
365
 
366
366
  case "codeBlock":
367
- const tag = element.attrs?.tag;
368
- if (tag) {
369
- // Tagged block where parsing failed at build time — store as data
370
- body.data[tag] = element.text;
371
- } else {
372
- // Untagged code block — collect as a snippet
373
- body.snippets.push({
374
- language: element.attrs?.language || '',
375
- code: typeof element.text === 'string' ? element.text : '',
376
- });
377
- }
367
+ body.snippets.push({
368
+ language: element.attrs?.language || '',
369
+ code: typeof element.text === 'string' ? element.text : '',
370
+ });
378
371
  break;
379
372
 
380
373
  case "inset":
@@ -145,13 +145,22 @@ function createSequenceElement(node, options = {}) {
145
145
  tag: attrs.tag,
146
146
  };
147
147
 
148
- case "codeBlock":
148
+ case "codeBlock": {
149
149
  const codeText = getTextContent(content, options);
150
+ // Tagged code blocks are semantically data blocks, not code
151
+ if (attrs?.tag) {
152
+ return {
153
+ type: "dataBlock",
154
+ tag: attrs.tag,
155
+ data: getCodeBlockData(codeText, attrs),
156
+ };
157
+ }
150
158
  return {
151
159
  type: "codeBlock",
152
- text: getCodeBlockData(codeText, attrs),
160
+ text: codeText,
153
161
  attrs,
154
162
  };
163
+ }
155
164
 
156
165
  case "inset_placeholder":
157
166
  return {