@markdoc/markdoc 0.3.5 → 0.5.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.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import Ast from './src/ast';
2
+ import Node from './src/ast/node';
2
3
  import format from './src/formatter';
3
4
  import functions from './src/functions';
4
5
  import * as nodes from './src/schema';
@@ -11,7 +12,7 @@ import transformer, { globalAttributes } from './src/transformer';
11
12
  import transforms from './src/transforms';
12
13
  import { parseTags } from './src/utils';
13
14
  import validator from './src/validator';
14
- import type { Node, ParserArgs } from './src/types';
15
+ import type { ParserArgs } from './src/types';
15
16
  import type Token from 'markdown-it/lib/token';
16
17
  import type { Config, RenderableTreeNode, ValidateError } from './src/types';
17
18
  export * from './src/types';
@@ -30,12 +31,12 @@ export declare function createElement(name: string | {
30
31
  attributes: {};
31
32
  children: any[];
32
33
  };
33
- export { nodes, tags, functions, globalAttributes, transforms, renderers, Ast, Tag, Tokenizer, parseTags, transformer, validator, truthy, format, };
34
+ export { nodes, tags, functions, globalAttributes, transforms, renderers, Ast, Node, Tag, Tokenizer, parseTags, transformer, validator, truthy, format, };
34
35
  export default class Markdoc {
35
36
  static nodes: typeof nodes;
36
37
  static tags: {
37
38
  else: import("./src/types").Schema<Readonly<Partial<{
38
- nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
39
+ nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Partial<any>, string>>>;
39
40
  tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
40
41
  variables: Record<string, any>;
41
42
  functions: Record<string, import("./src/types").ConfigFunction>;
@@ -47,7 +48,7 @@ export default class Markdoc {
47
48
  } | undefined;
48
49
  }>>, string>;
49
50
  if: import("./src/types").Schema<Readonly<Partial<{
50
- nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
51
+ nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Partial<any>, string>>>;
51
52
  tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
52
53
  variables: Record<string, any>;
53
54
  functions: Record<string, import("./src/types").ConfigFunction>;
@@ -59,7 +60,7 @@ export default class Markdoc {
59
60
  } | undefined;
60
61
  }>>, string>;
61
62
  partial: import("./src/types").Schema<Readonly<Partial<{
62
- nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
63
+ nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Partial<any>, string>>>;
63
64
  tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
64
65
  variables: Record<string, any>;
65
66
  functions: Record<string, import("./src/types").ConfigFunction>;
@@ -71,7 +72,7 @@ export default class Markdoc {
71
72
  } | undefined;
72
73
  }>>, string>;
73
74
  slot: import("./src/types").Schema<Readonly<Partial<{
74
- nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
75
+ nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Partial<any>, string>>>;
75
76
  tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
76
77
  variables: Record<string, any>;
77
78
  functions: Record<string, import("./src/types").ConfigFunction>;
@@ -83,7 +84,7 @@ export default class Markdoc {
83
84
  } | undefined;
84
85
  }>>, string>;
85
86
  table: import("./src/types").Schema<Readonly<Partial<{
86
- nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
87
+ nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Partial<any>, string>>>;
87
88
  tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
88
89
  variables: Record<string, any>;
89
90
  functions: Record<string, import("./src/types").ConfigFunction>;
@@ -117,7 +118,7 @@ export default class Markdoc {
117
118
  isVariable(value?: any): value is import("./src/ast/variable").default;
118
119
  getAstValues(value: any): Generator<import("./src/types").AstType, void, unknown>;
119
120
  resolve(value: any, config?: Readonly<Partial<{
120
- nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
121
+ nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Partial<any>, string>>>;
121
122
  tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
122
123
  variables: Record<string, any>;
123
124
  functions: Record<string, import("./src/types").ConfigFunction>;
@@ -144,7 +145,7 @@ export default class Markdoc {
144
145
  static truthy: typeof truthy;
145
146
  static format: typeof format;
146
147
  config: Readonly<Partial<{
147
- nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
148
+ nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Partial<any>, string>>>;
148
149
  tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
149
150
  variables: Record<string, any>;
150
151
  functions: Record<string, import("./src/types").ConfigFunction>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,WAAW,EAAE,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,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AAS;IACrB,MAAM,CAAC,SAAS,mBAAa;IAC7B,MAAM,CAAC,QAAQ,kBAAY;IAC3B,MAAM,CAAC,aAAa,uBAAiB;IACrC,MAAM,CAAC,MAAM,gBAAU;IACvB,MAAM,CAAC,MAAM,gBAAU;IAEvB,MAAM;;;;;;;;;;;QAAC;gBACK,MAAM,EAAE,MAAM;IAI1B,KAAK,eAAS;IACd,OAAO,YAAa,WAAW,cAAc,CAAC,CAAC,CAAC,CAAC,YACjB;IAChC,SAAS,YAAa,WAAW,gBAAgB,CAAC,CAAC,CAAC,CAAC,0BACnB;IAClC,QAAQ,YAAa,WAAW,eAAe,CAAC,CAAC,CAAC,CAAC,qBAClB;CAClC"}
package/dist/index.js CHANGED
@@ -141,6 +141,9 @@ var require_tag = __commonJS({
141
141
  var peg$c15 = "-";
142
142
  var peg$c16 = '"';
143
143
  var peg$c17 = "\\";
144
+ var peg$c18 = "n";
145
+ var peg$c19 = "r";
146
+ var peg$c20 = "t";
144
147
  var peg$r0 = /^[$@]/;
145
148
  var peg$r1 = /^[0-9]/;
146
149
  var peg$r2 = /^[^\0-\x1F"\\]/;
@@ -267,7 +270,16 @@ var require_tag = __commonJS({
267
270
  var peg$f28 = function(value) {
268
271
  return value.join("");
269
272
  };
270
- var peg$f29 = function(sequence) {
273
+ var peg$f29 = function() {
274
+ return "\n";
275
+ };
276
+ var peg$f30 = function() {
277
+ return "\r";
278
+ };
279
+ var peg$f31 = function() {
280
+ return " ";
281
+ };
282
+ var peg$f32 = function(sequence) {
271
283
  return sequence;
272
284
  };
273
285
  var peg$currPos = 0;
@@ -1525,7 +1537,7 @@ var require_tag = __commonJS({
1525
1537
  return s0;
1526
1538
  }
1527
1539
  function peg$parseValueStringEscapes() {
1528
- var s0, s1, s2;
1540
+ var s0, s1, s2, s3;
1529
1541
  var rule$expects = function(expected2) {
1530
1542
  if (peg$silentFails === 0)
1531
1543
  peg$expect(expected2);
@@ -1551,10 +1563,52 @@ var require_tag = __commonJS({
1551
1563
  } else {
1552
1564
  s2 = peg$FAILED;
1553
1565
  }
1566
+ if (s2 === peg$FAILED) {
1567
+ s2 = peg$currPos;
1568
+ if (input.charCodeAt(peg$currPos) === 110) {
1569
+ s3 = peg$c18;
1570
+ peg$currPos++;
1571
+ } else {
1572
+ s3 = peg$FAILED;
1573
+ }
1574
+ if (s3 !== peg$FAILED) {
1575
+ peg$savedPos = s2;
1576
+ s3 = peg$f29();
1577
+ }
1578
+ s2 = s3;
1579
+ if (s2 === peg$FAILED) {
1580
+ s2 = peg$currPos;
1581
+ if (input.charCodeAt(peg$currPos) === 114) {
1582
+ s3 = peg$c19;
1583
+ peg$currPos++;
1584
+ } else {
1585
+ s3 = peg$FAILED;
1586
+ }
1587
+ if (s3 !== peg$FAILED) {
1588
+ peg$savedPos = s2;
1589
+ s3 = peg$f30();
1590
+ }
1591
+ s2 = s3;
1592
+ if (s2 === peg$FAILED) {
1593
+ s2 = peg$currPos;
1594
+ if (input.charCodeAt(peg$currPos) === 116) {
1595
+ s3 = peg$c20;
1596
+ peg$currPos++;
1597
+ } else {
1598
+ s3 = peg$FAILED;
1599
+ }
1600
+ if (s3 !== peg$FAILED) {
1601
+ peg$savedPos = s2;
1602
+ s3 = peg$f31();
1603
+ }
1604
+ s2 = s3;
1605
+ }
1606
+ }
1607
+ }
1554
1608
  }
1555
1609
  if (s2 !== peg$FAILED) {
1556
1610
  peg$savedPos = s0;
1557
- s0 = peg$f29(s2);
1611
+ s0 = peg$f32(s2);
1558
1612
  } else {
1559
1613
  peg$currPos = s0;
1560
1614
  s0 = peg$FAILED;
@@ -6601,6 +6655,7 @@ var require_markdown_it = __commonJS({
6601
6655
  // index.ts
6602
6656
  __export(exports, {
6603
6657
  Ast: () => ast_default,
6658
+ Node: () => Node,
6604
6659
  Tag: () => Tag,
6605
6660
  Tokenizer: () => Tokenizer,
6606
6661
  createElement: () => createElement,
@@ -7135,7 +7190,7 @@ function* formatNode(n, o = {}) {
7135
7190
  yield* formatValue(n.attributes.alt, no);
7136
7191
  yield "]";
7137
7192
  yield "(";
7138
- yield* typeof n.attributes.src === "string" ? escapeMarkdownCharacters(n.attributes.src, /[()]/) : formatValue(n.attributes.src, no);
7193
+ yield* typeof n.attributes.src === "string" ? escapeMarkdownCharacters(n.attributes.src, /[()]/g) : formatValue(n.attributes.src, no);
7139
7194
  if (n.attributes.title) {
7140
7195
  yield SPACE + `"${n.attributes.title}"`;
7141
7196
  }
@@ -7187,6 +7242,7 @@ function* formatNode(n, o = {}) {
7187
7242
  const innerFence = n.attributes.content.match(/`{3,}/g) || [];
7188
7243
  const innerFenceLength = innerFence.map((s2) => s2.length).reduce(max, 0);
7189
7244
  const boundary = "`".repeat(innerFenceLength ? innerFenceLength + 1 : 3);
7245
+ const needsNlBeforeEndBoundary = !n.attributes.content.endsWith(NL);
7190
7246
  yield boundary;
7191
7247
  if (n.attributes.language)
7192
7248
  yield n.attributes.language;
@@ -7196,6 +7252,9 @@ function* formatNode(n, o = {}) {
7196
7252
  yield NL;
7197
7253
  yield indent;
7198
7254
  yield n.attributes.content.split(NL).join(NL + indent);
7255
+ if (needsNlBeforeEndBoundary) {
7256
+ yield NL;
7257
+ }
7199
7258
  yield boundary;
7200
7259
  yield NL;
7201
7260
  break;
@@ -7226,7 +7285,18 @@ function* formatNode(n, o = {}) {
7226
7285
  case "list": {
7227
7286
  const isLoose = n.children.some((n2) => n2.children.some((c) => c.type === "paragraph"));
7228
7287
  for (let i = 0; i < n.children.length; i++) {
7229
- const prefix = n.attributes.ordered ? `${i === 0 ? n.attributes.start ?? "1" : "1"}${n.attributes.marker ?? OL}` : n.attributes.marker ?? UL;
7288
+ const prefix = (() => {
7289
+ if (!n.attributes.ordered)
7290
+ return n.attributes.marker ?? UL;
7291
+ let number = "1";
7292
+ const startNumber = n.attributes.start ?? 1;
7293
+ if (i === 0)
7294
+ number = startNumber.toString();
7295
+ if (o.orderedListMode === "increment") {
7296
+ number = (parseInt(startNumber) + i).toString();
7297
+ }
7298
+ return `${number}${n.attributes.marker ?? OL}`;
7299
+ })();
7230
7300
  let d = format(n.children[i], increment(no, prefix.length + 1));
7231
7301
  if (!isLoose || i === n.children.length - 1) {
7232
7302
  d = d.trim();
@@ -7844,7 +7914,7 @@ var td = {
7844
7914
  var th = {
7845
7915
  render: "th",
7846
7916
  attributes: {
7847
- width: { type: Number },
7917
+ width: { type: String },
7848
7918
  align: { type: String },
7849
7919
  colspan: { type: Number, render: "colSpan" },
7850
7920
  rowspan: { type: Number, render: "rowSpan" }
@@ -7982,7 +8052,7 @@ function render(node2) {
7982
8052
  function tagName(name, components) {
7983
8053
  return typeof name !== "string" ? name : name[0] !== name[0].toUpperCase() ? name : components instanceof Function ? components(name) : components[name];
7984
8054
  }
7985
- function dynamic(node2, React, { components = {} } = {}) {
8055
+ function dynamic(node2, React, { components = {}, resolveTagName = tagName } = {}) {
7986
8056
  function deepRender2(value) {
7987
8057
  if (value == null || typeof value !== "object")
7988
8058
  return value;
@@ -8009,7 +8079,7 @@ function dynamic(node2, React, { components = {} } = {}) {
8009
8079
  } = node3;
8010
8080
  if (className)
8011
8081
  attrs.className = className;
8012
- return React.createElement(tagName(name, components), Object.keys(attrs).length == 0 ? null : deepRender2(attrs), ...children.map(render3));
8082
+ return React.createElement(resolveTagName(name, components), Object.keys(attrs).length == 0 ? null : deepRender2(attrs), ...children.map(render3));
8013
8083
  }
8014
8084
  return render3(node2);
8015
8085
  }
@@ -8050,10 +8120,13 @@ function render2(node2) {
8050
8120
  ${Object.keys(attrs).length == 0 ? "null" : deepRender(attrs)},
8051
8121
  ${renderArray(children)})`;
8052
8122
  }
8053
- function reactStatic(node2) {
8123
+ function reactStatic(node2, { resolveTagName = tagName2 } = {}) {
8124
+ if (resolveTagName.name !== "tagName") {
8125
+ throw new Error("resolveTagName must be named tagName");
8126
+ }
8054
8127
  return `
8055
8128
  (({components = {}} = {}) => {
8056
- ${tagName2}
8129
+ ${resolveTagName}
8057
8130
  return ${render2(node2)};
8058
8131
  })
8059
8132
  `;