@markdy/core 1.3.2 → 1.3.3

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -758,6 +758,7 @@ var SCENE_KEYS = /* @__PURE__ */ new Set([
758
758
  "duration",
759
759
  "direction",
760
760
  "layout",
761
+ "rankdir",
761
762
  "type",
762
763
  ...PLAYER_FLAT_KEYS
763
764
  ]);
@@ -3696,11 +3697,11 @@ function parse(source, opts = {}) {
3696
3697
  meta.title = title;
3697
3698
  remainder = str.rest;
3698
3699
  }
3699
- const inlineLayout = remainder.match(/\blayout\s+(LR|RL|TB|BT)\b/i);
3700
+ const inlineLayout = remainder.match(/\b(?:layout|direction|rankdir)\s+(LR|RL|TB|BT)\b/i);
3700
3701
  if (inlineLayout) {
3701
3702
  meta.direction = inlineLayout[1].toUpperCase();
3702
3703
  meta.explicitDirection = true;
3703
- remainder = remainder.replace(/\blayout\s+(LR|RL|TB|BT)\b/i, " ");
3704
+ remainder = remainder.replace(/\b(?:layout|direction|rankdir)\s+(LR|RL|TB|BT)\b/i, " ");
3704
3705
  }
3705
3706
  const props = parseProps(remainder);
3706
3707
  for (const [k, v] of Object.entries(props)) {
@@ -3721,7 +3722,7 @@ function parse(source, opts = {}) {
3721
3722
  const val = String(v).toLowerCase();
3722
3723
  meta.theme = val;
3723
3724
  meta.explicitTheme = val !== "auto";
3724
- } else if (k === "direction" || k === "layout") {
3725
+ } else if (k === "direction" || k === "layout" || k === "rankdir") {
3725
3726
  meta.direction = String(v).toUpperCase();
3726
3727
  meta.explicitDirection = true;
3727
3728
  } else if (PLAYER_FLAT_KEY_SET.has(k)) {
@@ -3733,8 +3734,9 @@ function parse(source, opts = {}) {
3733
3734
  diagnostics.push({ severity: "warning", message: `unknown diagram type '${v}'`, line: lineNo });
3734
3735
  } else {
3735
3736
  meta.type = t;
3736
- if (t === "flowchart" && !props.direction && !props.layout && !inlineLayout) {
3737
+ if (t === "flowchart" && !props.direction && !props.layout && !props.rankdir && !inlineLayout) {
3737
3738
  meta.direction = "TB";
3739
+ meta.explicitDirection = true;
3738
3740
  }
3739
3741
  }
3740
3742
  }
@@ -5893,7 +5895,7 @@ function diagnoseMarkdyCode(code, options = {}) {
5893
5895
  });
5894
5896
  }
5895
5897
  }
5896
- const layoutMatch = trimmed.match(/\blayout\s*=?\s*(\w+)/i);
5898
+ const layoutMatch = trimmed.match(/\b(?:layout|direction|rankdir)\s*=?\s*(\w+)/i);
5897
5899
  if (layoutMatch) {
5898
5900
  const layoutVal = layoutMatch[1].toUpperCase();
5899
5901
  if (!LAYOUT_DIRECTIONS.includes(layoutVal)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/core",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Diagram-native MarkdyScript parser and compiler (auto-layout, edge routing, cue scheduling) — zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "type": "module",