@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.js CHANGED
@@ -7082,12 +7082,28 @@ function* formatNode(n, o = {}) {
7082
7082
  yield* formatChildren(n, no);
7083
7083
  break;
7084
7084
  }
7085
+ case "image": {
7086
+ yield "!";
7087
+ yield "[";
7088
+ yield* formatValue(n.attributes.alt, no);
7089
+ yield "]";
7090
+ yield "(";
7091
+ yield* formatValue(n.attributes.src, no);
7092
+ if (n.attributes.title) {
7093
+ yield SPACE + `"${n.attributes.title}"`;
7094
+ }
7095
+ yield ")";
7096
+ break;
7097
+ }
7085
7098
  case "link": {
7086
7099
  yield "[";
7087
7100
  yield* formatChildren(n, no);
7088
7101
  yield "]";
7089
7102
  yield "(";
7090
7103
  yield* formatValue(n.attributes.href, no);
7104
+ if (n.attributes.title) {
7105
+ yield SPACE + `"${n.attributes.title}"`;
7106
+ }
7091
7107
  yield ")";
7092
7108
  break;
7093
7109
  }
@@ -7113,16 +7129,6 @@ function* formatNode(n, o = {}) {
7113
7129
  yield NL;
7114
7130
  break;
7115
7131
  }
7116
- case "image": {
7117
- yield "!";
7118
- yield "[";
7119
- yield* formatValue(n.attributes.alt, no);
7120
- yield "]";
7121
- yield "(";
7122
- yield* formatValue(n.attributes.src, no);
7123
- yield ")";
7124
- break;
7125
- }
7126
7132
  case "fence": {
7127
7133
  yield NL;
7128
7134
  yield indent;
@@ -7133,8 +7139,7 @@ function* formatNode(n, o = {}) {
7133
7139
  yield* formatAnnotations(n);
7134
7140
  yield NL;
7135
7141
  yield indent;
7136
- yield n.attributes.content;
7137
- yield indent;
7142
+ yield n.attributes.content.split(NL).join(NL + indent);
7138
7143
  yield "```";
7139
7144
  yield NL;
7140
7145
  break;
@@ -7172,8 +7177,12 @@ function* formatNode(n, o = {}) {
7172
7177
  break;
7173
7178
  }
7174
7179
  case "item": {
7175
- yield* formatChildren(n, no);
7176
- yield* formatAnnotations(n);
7180
+ for (let i = 0; i < n.children.length; i++) {
7181
+ const child = n.children[i];
7182
+ yield* formatValue(child, no);
7183
+ if (i === 0)
7184
+ yield* formatAnnotations(n);
7185
+ }
7177
7186
  break;
7178
7187
  }
7179
7188
  case "strong": {