md-annotator-opencode 0.7.0 → 0.8.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/dist/index.js CHANGED
@@ -27476,6 +27476,20 @@ var HTML_VOID_TAGS = /* @__PURE__ */ new Set([
27476
27476
  "track",
27477
27477
  "wbr"
27478
27478
  ]);
27479
+ var HTML_MIXED_CONTENT_TAGS = /* @__PURE__ */ new Set([
27480
+ "div",
27481
+ "section",
27482
+ "details",
27483
+ "aside",
27484
+ "article",
27485
+ "figure",
27486
+ "figcaption",
27487
+ "header",
27488
+ "footer",
27489
+ "main",
27490
+ "nav",
27491
+ "center"
27492
+ ]);
27479
27493
  function parseMarkdownToBlocks(markdown) {
27480
27494
  var _a, _b;
27481
27495
  const lines = markdown.split("\n");
@@ -27650,10 +27664,52 @@ function parseMarkdownToBlocks(markdown) {
27650
27664
  flush();
27651
27665
  const tagName = tagMatch[1].toLowerCase();
27652
27666
  const htmlStartLine = currentLineNum;
27653
- const htmlLines = [line];
27654
27667
  const isSelfClosing = trimmed.endsWith("/>");
27655
27668
  const isVoid = HTML_VOID_TAGS.has(tagName);
27656
27669
  const hasSameLineClose = new RegExp(`</${tagName}\\s*>`, "i").test(trimmed);
27670
+ if (!isSelfClosing && !isVoid && !hasSameLineClose && HTML_MIXED_CONTENT_TAGS.has(tagName)) {
27671
+ const closePattern = new RegExp(`</${tagName}\\s*>`, "i");
27672
+ const openPattern = new RegExp(`<${tagName}[\\s>/]`, "i");
27673
+ const innerLines = [];
27674
+ let closingLine = null;
27675
+ let depth = 1;
27676
+ i++;
27677
+ while (i < lines.length) {
27678
+ if (openPattern.test(lines[i].trim())) {
27679
+ depth++;
27680
+ }
27681
+ if (closePattern.test(lines[i].trim())) {
27682
+ depth--;
27683
+ if (depth === 0) {
27684
+ closingLine = lines[i];
27685
+ break;
27686
+ }
27687
+ }
27688
+ innerLines.push(lines[i]);
27689
+ i++;
27690
+ }
27691
+ blocks.push({
27692
+ id: `block-${currentId++}`,
27693
+ type: "html",
27694
+ content: line,
27695
+ order: currentId,
27696
+ startLine: htmlStartLine
27697
+ });
27698
+ for (const inner of parseMarkdownToBlocks(innerLines.join("\n"))) {
27699
+ blocks.push({ ...inner, id: `block-${currentId++}`, order: currentId, startLine: htmlStartLine + inner.startLine });
27700
+ }
27701
+ if (closingLine) {
27702
+ blocks.push({
27703
+ id: `block-${currentId++}`,
27704
+ type: "html",
27705
+ content: closingLine,
27706
+ order: currentId,
27707
+ startLine: htmlStartLine + innerLines.length + 1
27708
+ });
27709
+ }
27710
+ continue;
27711
+ }
27712
+ const htmlLines = [line];
27657
27713
  if (!isSelfClosing && !isVoid && !hasSameLineClose) {
27658
27714
  const closePattern = new RegExp(`</${tagName}\\s*>`, "i");
27659
27715
  const openPattern = new RegExp(`<${tagName}[\\s>/]`, "i");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md-annotator-opencode",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "OpenCode plugin for interactive markdown annotation",
5
5
  "license": "MIT",
6
6
  "type": "module",