@markdoc/markdoc 0.1.11 → 0.1.12

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.mjs CHANGED
@@ -7058,12 +7058,28 @@ function* formatNode(n, o = {}) {
7058
7058
  yield* formatChildren(n, no);
7059
7059
  break;
7060
7060
  }
7061
+ case "image": {
7062
+ yield "!";
7063
+ yield "[";
7064
+ yield* formatValue(n.attributes.alt, no);
7065
+ yield "]";
7066
+ yield "(";
7067
+ yield* formatValue(n.attributes.src, no);
7068
+ if (n.attributes.title) {
7069
+ yield SPACE + `"${n.attributes.title}"`;
7070
+ }
7071
+ yield ")";
7072
+ break;
7073
+ }
7061
7074
  case "link": {
7062
7075
  yield "[";
7063
7076
  yield* formatChildren(n, no);
7064
7077
  yield "]";
7065
7078
  yield "(";
7066
7079
  yield* formatValue(n.attributes.href, no);
7080
+ if (n.attributes.title) {
7081
+ yield SPACE + `"${n.attributes.title}"`;
7082
+ }
7067
7083
  yield ")";
7068
7084
  break;
7069
7085
  }
@@ -7089,16 +7105,6 @@ function* formatNode(n, o = {}) {
7089
7105
  yield NL;
7090
7106
  break;
7091
7107
  }
7092
- case "image": {
7093
- yield "!";
7094
- yield "[";
7095
- yield* formatValue(n.attributes.alt, no);
7096
- yield "]";
7097
- yield "(";
7098
- yield* formatValue(n.attributes.src, no);
7099
- yield ")";
7100
- break;
7101
- }
7102
7108
  case "fence": {
7103
7109
  yield NL;
7104
7110
  yield indent;
@@ -7109,8 +7115,7 @@ function* formatNode(n, o = {}) {
7109
7115
  yield* formatAnnotations(n);
7110
7116
  yield NL;
7111
7117
  yield indent;
7112
- yield n.attributes.content;
7113
- yield indent;
7118
+ yield n.attributes.content.split(NL).join(NL + indent);
7114
7119
  yield "```";
7115
7120
  yield NL;
7116
7121
  break;
@@ -7148,8 +7153,12 @@ function* formatNode(n, o = {}) {
7148
7153
  break;
7149
7154
  }
7150
7155
  case "item": {
7151
- yield* formatChildren(n, no);
7152
- yield* formatAnnotations(n);
7156
+ for (let i = 0; i < n.children.length; i++) {
7157
+ const child = n.children[i];
7158
+ yield* formatValue(child, no);
7159
+ if (i === 0)
7160
+ yield* formatAnnotations(n);
7161
+ }
7153
7162
  break;
7154
7163
  }
7155
7164
  case "strong": {