@luckyfishes/markdown-core 0.2.0 → 0.2.1

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.cjs CHANGED
@@ -747,6 +747,7 @@ function splitTabSections(value) {
747
747
  let yamlSource = "";
748
748
  let yamlCaptured = false;
749
749
  let inInnerFence = null;
750
+ let nestedBlockDepth = 0;
750
751
  for (const line of lines) {
751
752
  const trimmed = line.trim();
752
753
  if (inInnerFence) {
@@ -766,7 +767,17 @@ function splitTabSections(value) {
766
767
  currentSection.push(line);
767
768
  continue;
768
769
  }
769
- if (YAML_BODY_SPLIT_RE.test(line)) {
770
+ if (DOUBLE_BLOCK_START_RE.test(line)) {
771
+ nestedBlockDepth += 1;
772
+ currentSection.push(line);
773
+ continue;
774
+ }
775
+ if (BLOCK_END_RE.test(line) && nestedBlockDepth > 0) {
776
+ nestedBlockDepth -= 1;
777
+ currentSection.push(line);
778
+ continue;
779
+ }
780
+ if (nestedBlockDepth === 0 && YAML_BODY_SPLIT_RE.test(line)) {
770
781
  if (!yamlCaptured) {
771
782
  yamlSource = currentSection.join("\n");
772
783
  yamlCaptured = true;
package/dist/index.js CHANGED
@@ -700,6 +700,7 @@ function splitTabSections(value) {
700
700
  let yamlSource = "";
701
701
  let yamlCaptured = false;
702
702
  let inInnerFence = null;
703
+ let nestedBlockDepth = 0;
703
704
  for (const line of lines) {
704
705
  const trimmed = line.trim();
705
706
  if (inInnerFence) {
@@ -719,7 +720,17 @@ function splitTabSections(value) {
719
720
  currentSection.push(line);
720
721
  continue;
721
722
  }
722
- if (YAML_BODY_SPLIT_RE.test(line)) {
723
+ if (DOUBLE_BLOCK_START_RE.test(line)) {
724
+ nestedBlockDepth += 1;
725
+ currentSection.push(line);
726
+ continue;
727
+ }
728
+ if (BLOCK_END_RE.test(line) && nestedBlockDepth > 0) {
729
+ nestedBlockDepth -= 1;
730
+ currentSection.push(line);
731
+ continue;
732
+ }
733
+ if (nestedBlockDepth === 0 && YAML_BODY_SPLIT_RE.test(line)) {
723
734
  if (!yamlCaptured) {
724
735
  yamlSource = currentSection.join("\n");
725
736
  yamlCaptured = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luckyfishes/markdown-core",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Core Markdown/MDX parsing and AST transformation utilities extracted from noname_blog.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",