@markdoc/markdoc 0.1.13 → 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/README.md +9 -7
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -29
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +45 -29
- package/dist/index.mjs.map +3 -3
- package/dist/react.js +16 -5
- package/dist/react.js.map +3 -3
- package/dist/src/formatter.d.ts.map +1 -1
- package/dist/src/renderers/html.d.ts.map +1 -1
- package/dist/src/renderers/react/react.d.ts +1 -1
- package/dist/src/renderers/react/react.d.ts.map +1 -1
- package/dist/src/renderers/react/static.d.ts +1 -1
- package/dist/src/renderers/react/static.d.ts.map +1 -1
- package/dist/src/tag.d.ts +1 -0
- package/dist/src/tag.d.ts.map +1 -1
- package/dist/src/tags/conditional.d.ts +1 -1
- package/dist/src/tags/conditional.d.ts.map +1 -1
- package/dist/src/transformer.d.ts.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/index.ts +3 -3
- package/package.json +10 -3
- package/src/formatter.test.ts +70 -7
- package/src/formatter.ts +41 -12
- package/src/renderers/html.test.ts +10 -6
- package/src/renderers/html.ts +3 -2
- package/src/renderers/react/react.test.ts +5 -12
- package/src/renderers/react/react.ts +21 -4
- package/src/renderers/react/static.ts +21 -3
- package/src/tag.test.ts +17 -0
- package/src/tag.ts +4 -0
- package/src/tags/conditional.ts +11 -2
- package/src/transformer.ts +12 -2
- package/src/types.ts +1 -1
- package/src/utils.ts +2 -2
- package/dist/src/renderers/react/shared.d.ts +0 -5
- package/dist/src/renderers/react/shared.d.ts.map +0 -1
- package/src/renderers/react/shared.ts +0 -16
package/README.md
CHANGED
|
@@ -54,13 +54,7 @@ Check out [our docs](https://markdoc.dev/docs) for more guidance on how to use M
|
|
|
54
54
|
|
|
55
55
|
### TypeScript
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
npm install @markdoc/markdoc @types/react @types/markdown-it
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Additionally, this is the minimal `tsconfig.json` required to use Markdoc in your TypeScript project:
|
|
57
|
+
This is the minimal `tsconfig.json` required to use Markdoc in your TypeScript project:
|
|
64
58
|
|
|
65
59
|
```json
|
|
66
60
|
{
|
|
@@ -72,6 +66,14 @@ Additionally, this is the minimal `tsconfig.json` required to use Markdoc in you
|
|
|
72
66
|
}
|
|
73
67
|
```
|
|
74
68
|
|
|
69
|
+
### React
|
|
70
|
+
|
|
71
|
+
If you are using React, install Markdoc with:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
npm install @markdoc/markdoc react @types/react
|
|
75
|
+
```
|
|
76
|
+
|
|
75
77
|
## Contributing
|
|
76
78
|
|
|
77
79
|
Contributions and feedback are welcome and encouraged. Check out our [contributing guidelines](.github/CONTRIBUTING.md) on how to do so.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Ast from './src/ast';
|
|
2
|
-
import
|
|
2
|
+
import format from './src/formatter';
|
|
3
3
|
import functions from './src/functions';
|
|
4
4
|
import * as nodes from './src/schema';
|
|
5
5
|
import renderers from './src/renderers';
|
|
@@ -30,7 +30,7 @@ export declare function createElement(name: string | {
|
|
|
30
30
|
attributes: {};
|
|
31
31
|
children: any[];
|
|
32
32
|
};
|
|
33
|
-
export { nodes, tags, functions, globalAttributes, transforms, renderers, Ast, Tag, Tokenizer, parseTags, transformer, validator, truthy,
|
|
33
|
+
export { nodes, tags, functions, globalAttributes, transforms, renderers, Ast, Tag, Tokenizer, parseTags, transformer, validator, truthy, format, };
|
|
34
34
|
export default class Markdoc {
|
|
35
35
|
static nodes: typeof nodes;
|
|
36
36
|
static tags: {
|
|
@@ -120,7 +120,7 @@ export default class Markdoc {
|
|
|
120
120
|
static validate: typeof validate;
|
|
121
121
|
static createElement: typeof createElement;
|
|
122
122
|
static truthy: typeof truthy;
|
|
123
|
-
static
|
|
123
|
+
static format: typeof format;
|
|
124
124
|
config: Readonly<Partial<{
|
|
125
125
|
nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
|
|
126
126
|
tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -6603,9 +6603,9 @@ __export(exports, {
|
|
|
6603
6603
|
Ast: () => ast_default,
|
|
6604
6604
|
Tag: () => Tag,
|
|
6605
6605
|
Tokenizer: () => Tokenizer,
|
|
6606
|
-
__EXPERIMENTAL__format: () => format,
|
|
6607
6606
|
createElement: () => createElement,
|
|
6608
6607
|
default: () => Markdoc,
|
|
6608
|
+
format: () => format,
|
|
6609
6609
|
functions: () => functions_default,
|
|
6610
6610
|
globalAttributes: () => globalAttributes,
|
|
6611
6611
|
nodes: () => schema_exports,
|
|
@@ -6677,6 +6677,9 @@ var Tag = class {
|
|
|
6677
6677
|
this.children = children;
|
|
6678
6678
|
}
|
|
6679
6679
|
};
|
|
6680
|
+
Tag.isTag = (tag) => {
|
|
6681
|
+
return !!(tag?.$$mdtype === "Tag");
|
|
6682
|
+
};
|
|
6680
6683
|
|
|
6681
6684
|
// src/schema-types/class.ts
|
|
6682
6685
|
var Class = class {
|
|
@@ -6758,7 +6761,7 @@ var OPEN = "{%";
|
|
|
6758
6761
|
var CLOSE = "%}";
|
|
6759
6762
|
var IDENTIFIER_REGEX = /^[a-zA-Z0-9_-]+$/;
|
|
6760
6763
|
function isIdentifier(s2) {
|
|
6761
|
-
return IDENTIFIER_REGEX.test(s2);
|
|
6764
|
+
return typeof s2 === "string" && IDENTIFIER_REGEX.test(s2);
|
|
6762
6765
|
}
|
|
6763
6766
|
function isPromise(a) {
|
|
6764
6767
|
return a && typeof a === "object" && typeof a.then === "function";
|
|
@@ -6993,6 +6996,9 @@ function* formatChildren(a, options) {
|
|
|
6993
6996
|
yield* formatValue(child, options);
|
|
6994
6997
|
}
|
|
6995
6998
|
}
|
|
6999
|
+
function* formatInline(g) {
|
|
7000
|
+
yield [...g].join("").trim();
|
|
7001
|
+
}
|
|
6996
7002
|
function* formatTableRow(items) {
|
|
6997
7003
|
yield `| ${items.join(" | ")} |`;
|
|
6998
7004
|
}
|
|
@@ -7042,8 +7048,10 @@ function* formatVariable(v) {
|
|
|
7042
7048
|
yield v.path.map((p, i) => {
|
|
7043
7049
|
if (i === 0)
|
|
7044
7050
|
return p;
|
|
7045
|
-
if (isIdentifier(
|
|
7051
|
+
if (isIdentifier(p))
|
|
7046
7052
|
return "." + p;
|
|
7053
|
+
if (typeof p === "number")
|
|
7054
|
+
return `[${p}]`;
|
|
7047
7055
|
return `["${p}"]`;
|
|
7048
7056
|
}).join("");
|
|
7049
7057
|
}
|
|
@@ -7064,6 +7072,9 @@ function* trimStart(g) {
|
|
|
7064
7072
|
yield n;
|
|
7065
7073
|
yield* g;
|
|
7066
7074
|
}
|
|
7075
|
+
function* escapeMarkdownCharacters(s2, characters) {
|
|
7076
|
+
yield s2.replace(characters, "\\$&").replace(new RegExp("\xA0", "g"), " ");
|
|
7077
|
+
}
|
|
7067
7078
|
function* formatNode(n, o = {}) {
|
|
7068
7079
|
const no = { ...o, parent: n };
|
|
7069
7080
|
const indent = SPACE.repeat(no.indent || 0);
|
|
@@ -7103,7 +7114,7 @@ function* formatNode(n, o = {}) {
|
|
|
7103
7114
|
yield* formatValue(n.attributes.alt, no);
|
|
7104
7115
|
yield "]";
|
|
7105
7116
|
yield "(";
|
|
7106
|
-
yield* formatValue(n.attributes.src, no);
|
|
7117
|
+
yield* typeof n.attributes.src === "string" ? escapeMarkdownCharacters(n.attributes.src, /[()]/) : formatValue(n.attributes.src, no);
|
|
7107
7118
|
if (n.attributes.title) {
|
|
7108
7119
|
yield SPACE + `"${n.attributes.title}"`;
|
|
7109
7120
|
}
|
|
@@ -7115,7 +7126,7 @@ function* formatNode(n, o = {}) {
|
|
|
7115
7126
|
yield* formatChildren(n, no);
|
|
7116
7127
|
yield "]";
|
|
7117
7128
|
yield "(";
|
|
7118
|
-
yield* formatValue(n.attributes.href, no);
|
|
7129
|
+
yield* typeof n.attributes.href === "string" ? escapeMarkdownCharacters(n.attributes.href, /[()]/g) : formatValue(n.attributes.href, no);
|
|
7119
7130
|
if (n.attributes.title) {
|
|
7120
7131
|
yield SPACE + `"${n.attributes.title}"`;
|
|
7121
7132
|
}
|
|
@@ -7123,10 +7134,11 @@ function* formatNode(n, o = {}) {
|
|
|
7123
7134
|
break;
|
|
7124
7135
|
}
|
|
7125
7136
|
case "text": {
|
|
7126
|
-
|
|
7137
|
+
const { content } = n.attributes;
|
|
7138
|
+
if (ast_default.isAst(content))
|
|
7127
7139
|
yield OPEN + SPACE;
|
|
7128
|
-
yield* formatValue(
|
|
7129
|
-
if (ast_default.isAst(
|
|
7140
|
+
yield* typeof content === "string" ? escapeMarkdownCharacters(content, /[_*~]/g) : formatValue(content, no);
|
|
7141
|
+
if (ast_default.isAst(content))
|
|
7130
7142
|
yield SPACE + CLOSE;
|
|
7131
7143
|
break;
|
|
7132
7144
|
}
|
|
@@ -7147,7 +7159,10 @@ function* formatNode(n, o = {}) {
|
|
|
7147
7159
|
case "fence": {
|
|
7148
7160
|
yield NL;
|
|
7149
7161
|
yield indent;
|
|
7150
|
-
|
|
7162
|
+
const innerFence = n.attributes.content.match(/`{3,}/g) || [];
|
|
7163
|
+
const innerFenceLength = innerFence.map((s2) => s2.length).reduce(max, 0);
|
|
7164
|
+
const boundary = "`".repeat(innerFenceLength ? innerFenceLength + 1 : 3);
|
|
7165
|
+
yield boundary;
|
|
7151
7166
|
if (n.attributes.language)
|
|
7152
7167
|
yield n.attributes.language;
|
|
7153
7168
|
if (n.annotations.length)
|
|
@@ -7156,7 +7171,7 @@ function* formatNode(n, o = {}) {
|
|
|
7156
7171
|
yield NL;
|
|
7157
7172
|
yield indent;
|
|
7158
7173
|
yield n.attributes.content.split(NL).join(NL + indent);
|
|
7159
|
-
yield
|
|
7174
|
+
yield boundary;
|
|
7160
7175
|
yield NL;
|
|
7161
7176
|
break;
|
|
7162
7177
|
}
|
|
@@ -7201,25 +7216,25 @@ function* formatNode(n, o = {}) {
|
|
|
7201
7216
|
}
|
|
7202
7217
|
case "strong": {
|
|
7203
7218
|
yield "**";
|
|
7204
|
-
yield* formatChildren(n, no);
|
|
7219
|
+
yield* formatInline(formatChildren(n, no));
|
|
7205
7220
|
yield "**";
|
|
7206
7221
|
break;
|
|
7207
7222
|
}
|
|
7208
7223
|
case "em": {
|
|
7209
7224
|
yield "_";
|
|
7210
|
-
yield* formatChildren(n, no);
|
|
7225
|
+
yield* formatInline(formatChildren(n, no));
|
|
7211
7226
|
yield "_";
|
|
7212
7227
|
break;
|
|
7213
7228
|
}
|
|
7214
7229
|
case "code": {
|
|
7215
7230
|
yield "`";
|
|
7216
|
-
yield* formatValue(n.attributes.content, no);
|
|
7231
|
+
yield* formatInline(formatValue(n.attributes.content, no));
|
|
7217
7232
|
yield "`";
|
|
7218
7233
|
break;
|
|
7219
7234
|
}
|
|
7220
7235
|
case "s": {
|
|
7221
7236
|
yield "~~";
|
|
7222
|
-
yield* formatChildren(n, no);
|
|
7237
|
+
yield* formatInline(formatChildren(n, no));
|
|
7223
7238
|
yield "~~";
|
|
7224
7239
|
break;
|
|
7225
7240
|
}
|
|
@@ -7878,10 +7893,10 @@ var voidElements = new Set([
|
|
|
7878
7893
|
]);
|
|
7879
7894
|
function render(node2) {
|
|
7880
7895
|
if (typeof node2 === "string" || typeof node2 === "number")
|
|
7881
|
-
return escapeHtml(node2);
|
|
7896
|
+
return escapeHtml(String(node2));
|
|
7882
7897
|
if (Array.isArray(node2))
|
|
7883
7898
|
return node2.map(render).join("");
|
|
7884
|
-
if (node2 === null || typeof node2 !== "object")
|
|
7899
|
+
if (node2 === null || typeof node2 !== "object" || !Tag.isTag(node2))
|
|
7885
7900
|
return "";
|
|
7886
7901
|
const { name, attributes, children = [] } = node2;
|
|
7887
7902
|
if (!name)
|
|
@@ -7898,12 +7913,10 @@ function render(node2) {
|
|
|
7898
7913
|
return output;
|
|
7899
7914
|
}
|
|
7900
7915
|
|
|
7901
|
-
// src/renderers/react/
|
|
7916
|
+
// src/renderers/react/react.ts
|
|
7902
7917
|
function tagName(name, components) {
|
|
7903
|
-
return typeof name !== "string" ?
|
|
7918
|
+
return typeof name !== "string" ? name : name[0] !== name[0].toUpperCase() ? name : components instanceof Function ? components(name) : components[name];
|
|
7904
7919
|
}
|
|
7905
|
-
|
|
7906
|
-
// src/renderers/react/react.ts
|
|
7907
7920
|
function dynamic(node2, React, { components = {} } = {}) {
|
|
7908
7921
|
function deepRender2(value) {
|
|
7909
7922
|
if (value == null || typeof value !== "object")
|
|
@@ -7922,7 +7935,7 @@ function dynamic(node2, React, { components = {} } = {}) {
|
|
|
7922
7935
|
function render3(node3) {
|
|
7923
7936
|
if (Array.isArray(node3))
|
|
7924
7937
|
return React.createElement(React.Fragment, null, ...node3.map(render3));
|
|
7925
|
-
if (node3 === null || typeof node3 !== "object")
|
|
7938
|
+
if (node3 === null || typeof node3 !== "object" || !Tag.isTag(node3))
|
|
7926
7939
|
return node3;
|
|
7927
7940
|
const {
|
|
7928
7941
|
name,
|
|
@@ -7937,6 +7950,9 @@ function dynamic(node2, React, { components = {} } = {}) {
|
|
|
7937
7950
|
}
|
|
7938
7951
|
|
|
7939
7952
|
// src/renderers/react/static.ts
|
|
7953
|
+
function tagName2(name, components) {
|
|
7954
|
+
return typeof name !== "string" ? "Fragment" : name[0] !== name[0].toUpperCase() ? name : components instanceof Function ? components(name) : components[name];
|
|
7955
|
+
}
|
|
7940
7956
|
function renderArray(children) {
|
|
7941
7957
|
return children.map(render2).join(", ");
|
|
7942
7958
|
}
|
|
@@ -7955,7 +7971,7 @@ function deepRender(value) {
|
|
|
7955
7971
|
function render2(node2) {
|
|
7956
7972
|
if (Array.isArray(node2))
|
|
7957
7973
|
return `React.createElement(React.Fragment, null, ${renderArray(node2)})`;
|
|
7958
|
-
if (node2 === null || typeof node2 !== "object")
|
|
7974
|
+
if (node2 === null || typeof node2 !== "object" || !Tag.isTag(node2))
|
|
7959
7975
|
return JSON.stringify(node2);
|
|
7960
7976
|
const {
|
|
7961
7977
|
name,
|
|
@@ -7972,7 +7988,7 @@ function render2(node2) {
|
|
|
7972
7988
|
function reactStatic(node2) {
|
|
7973
7989
|
return `
|
|
7974
7990
|
(({components = {}} = {}) => {
|
|
7975
|
-
${
|
|
7991
|
+
${tagName2}
|
|
7976
7992
|
return ${render2(node2)};
|
|
7977
7993
|
})
|
|
7978
7994
|
`;
|
|
@@ -8041,10 +8057,10 @@ var tags_default = {
|
|
|
8041
8057
|
var import_lib = __toModule(require_lib());
|
|
8042
8058
|
|
|
8043
8059
|
// src/tokenizer/plugins/annotations.ts
|
|
8044
|
-
var
|
|
8060
|
+
var import_tag7 = __toModule(require_tag());
|
|
8045
8061
|
function createToken(state, content, contentStart) {
|
|
8046
8062
|
try {
|
|
8047
|
-
const { type, meta, nesting = 0 } = (0,
|
|
8063
|
+
const { type, meta, nesting = 0 } = (0, import_tag7.parse)(content, { Variable, Function: Function2 });
|
|
8048
8064
|
const token = state.push(type, "", nesting);
|
|
8049
8065
|
token.info = content;
|
|
8050
8066
|
token.meta = meta;
|
|
@@ -8053,7 +8069,7 @@ function createToken(state, content, contentStart) {
|
|
|
8053
8069
|
}
|
|
8054
8070
|
return token;
|
|
8055
8071
|
} catch (error2) {
|
|
8056
|
-
if (!(error2 instanceof
|
|
8072
|
+
if (!(error2 instanceof import_tag7.SyntaxError))
|
|
8057
8073
|
throw error2;
|
|
8058
8074
|
const {
|
|
8059
8075
|
message,
|
|
@@ -8111,10 +8127,10 @@ function core(state) {
|
|
|
8111
8127
|
const end = findTagEnd(token.info, start);
|
|
8112
8128
|
const content = token.info.slice(start + OPEN.length, end);
|
|
8113
8129
|
try {
|
|
8114
|
-
const { meta } = (0,
|
|
8130
|
+
const { meta } = (0, import_tag7.parse)(content.trim(), { Variable, Function: Function2 });
|
|
8115
8131
|
token.meta = meta;
|
|
8116
8132
|
} catch (error2) {
|
|
8117
|
-
if (!(error2 instanceof
|
|
8133
|
+
if (!(error2 instanceof import_tag7.SyntaxError))
|
|
8118
8134
|
throw error2;
|
|
8119
8135
|
if (!token.errors)
|
|
8120
8136
|
token.errors = [];
|
|
@@ -8504,4 +8520,4 @@ Markdoc.transform = transform2;
|
|
|
8504
8520
|
Markdoc.validate = validate;
|
|
8505
8521
|
Markdoc.createElement = createElement;
|
|
8506
8522
|
Markdoc.truthy = truthy;
|
|
8507
|
-
Markdoc.
|
|
8523
|
+
Markdoc.format = format;
|