@markdoc/markdoc 0.5.13 → 0.6.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/README.md +29 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1228 -1143
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +1228 -1143
- package/dist/index.mjs.map +4 -4
- package/dist/react.js +1 -1
- package/dist/react.js.map +2 -2
- package/dist/src/ast/base.d.ts +1 -1
- package/dist/src/ast/base.d.ts.map +1 -1
- package/dist/src/ast/function.d.ts +1 -1
- package/dist/src/ast/function.d.ts.map +1 -1
- package/dist/src/ast/index.d.ts +2 -2
- package/dist/src/ast/index.d.ts.map +1 -1
- package/dist/src/ast/node.d.ts.map +1 -1
- package/dist/src/ast/variable.d.ts +1 -1
- package/dist/src/ast/variable.d.ts.map +1 -1
- package/dist/src/formatter.d.ts.map +1 -1
- package/dist/src/functions/index.d.ts.map +1 -1
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/renderers/html.d.ts.map +1 -1
- package/dist/src/renderers/react/react.d.ts +3 -3
- 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/schema-types/class.d.ts +1 -1
- package/dist/src/schema-types/class.d.ts.map +1 -1
- package/dist/src/schema-types/conditional.d.ts +1 -1
- package/dist/src/schema-types/conditional.d.ts.map +1 -1
- package/dist/src/schema.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/tokenizer/index.d.ts.map +1 -1
- package/dist/src/tokenizer/plugins/annotations.d.ts.map +1 -1
- package/dist/src/transformer.d.ts.map +1 -1
- package/dist/src/validator.d.ts +1 -1
- package/dist/src/validator.d.ts.map +1 -1
- package/index.ts +21 -22
- package/package.json +9 -14
- package/spec/support/matchers.d.ts +6 -4
- package/src/ast/base.test.ts +120 -0
- package/src/ast/base.ts +14 -9
- package/src/ast/function.ts +1 -1
- package/src/ast/index.ts +3 -4
- package/src/ast/node.test.ts +140 -45
- package/src/ast/node.ts +32 -13
- package/src/ast/variable.test.ts +5 -4
- package/src/ast/variable.ts +1 -1
- package/src/ast/walk.test.ts +283 -0
- package/src/formatter.test.ts +31 -3
- package/src/formatter.ts +12 -12
- package/src/functions/index.test.ts +8 -7
- package/src/functions/index.ts +1 -1
- package/src/grammar/tag.d.ts +1 -1
- package/src/grammar/tag.js +208 -285
- package/src/grammar/tag.pegjs +4 -4
- package/src/grammar/tag.test.ts +56 -52
- package/src/parser.test.ts +93 -70
- package/src/parser.ts +19 -6
- package/src/renderers/html.test.ts +56 -16
- package/src/renderers/html.ts +10 -2
- package/src/renderers/react/react.test.ts +49 -28
- package/src/renderers/react/react.ts +8 -9
- package/src/renderers/react/static.ts +7 -12
- package/src/schema-types/class.ts +1 -1
- package/src/schema-types/conditional.ts +1 -1
- package/src/schema.ts +13 -6
- package/src/tag.test.ts +2 -1
- package/src/tag.ts +1 -1
- package/src/tags/conditional.ts +4 -4
- package/src/tags/index.ts +2 -2
- package/src/tags/partial.ts +1 -1
- package/src/tokenizer/index.ts +6 -5
- package/src/tokenizer/plugins/annotations.test.ts +29 -28
- package/src/tokenizer/plugins/annotations.ts +12 -12
- package/src/tokenizer/plugins/comments.test.ts +11 -10
- package/src/tokenizer/plugins/comments.ts +2 -2
- package/src/tokenizer/plugins/frontmatter.test.ts +7 -6
- package/src/tokenizer/plugins/frontmatter.ts +2 -2
- package/src/tokenizer/plugins/link.test.ts +14 -13
- package/src/transformer.ts +7 -5
- package/src/transforms/table.test.ts +18 -17
- package/src/transforms/table.ts +1 -1
- package/src/utils.test.ts +23 -22
- package/src/utils.ts +3 -3
- package/src/validator.test.ts +60 -59
- package/src/validator.ts +43 -14
package/README.md
CHANGED
|
@@ -46,6 +46,18 @@ return Markdoc.renderers.react(content, React);
|
|
|
46
46
|
|
|
47
47
|
Check out [our docs](https://markdoc.dev/docs) for more guidance on how to use Markdoc.
|
|
48
48
|
|
|
49
|
+
### Agent skills
|
|
50
|
+
|
|
51
|
+
The [Markdoc agent plugin](https://github.com/markdoc/markdoc/tree/main/plugins/markdoc)
|
|
52
|
+
provides `setup-markdoc`, `write-markdoc`, and `create-markdoc-tag` skills for
|
|
53
|
+
Codex and Claude Code. Install them through [skills.sh](https://skills.sh/docs/cli):
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pnpm dlx skills add https://markdoc.dev
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
See the plugin README for marketplace installation and local testing.
|
|
60
|
+
|
|
49
61
|
### TypeScript
|
|
50
62
|
|
|
51
63
|
The public renderer types require `@types/react`, even when using only the
|
|
@@ -90,6 +102,9 @@ If using Corepack, run `corepack enable` first.
|
|
|
90
102
|
This repository uses pnpm workspaces and Turborepo:
|
|
91
103
|
|
|
92
104
|
- `packages/markdoc` contains the published `@markdoc/markdoc` library, its tests, and build configuration.
|
|
105
|
+
- `packages/next.js` contains the published `@markdoc/next.js` integration and its tests.
|
|
106
|
+
- `packages/cli` contains the published `@markdoc/cli` command-line tool and its tests.
|
|
107
|
+
- `apps/docs` contains the private documentation site deployed at [markdoc.dev](https://markdoc.dev).
|
|
93
108
|
- `packages/*` is the home for additional packages.
|
|
94
109
|
- `apps/*` is the home for applications.
|
|
95
110
|
|
|
@@ -97,13 +112,14 @@ Run these commands from the repository root:
|
|
|
97
112
|
|
|
98
113
|
1. Run `pnpm install`
|
|
99
114
|
1. Run `pnpm run build`
|
|
115
|
+
1. Run `pnpm lint` to check formatting, imports, and lint rules
|
|
100
116
|
1. Run the tests using `pnpm test`
|
|
101
117
|
1. Check the built package's TypeScript declarations using `pnpm run test:types`
|
|
102
118
|
|
|
103
119
|
Add release notes with `pnpm changeset`. See the [Changesets guide](.changeset/README.md)
|
|
104
120
|
for versioning and the release process.
|
|
105
121
|
|
|
106
|
-
Run `pnpm run check` for
|
|
122
|
+
Run `pnpm run check` for the workspace checks. Turborepo builds workspace dependencies
|
|
107
123
|
first and caches build outputs in each package's `dist` directory.
|
|
108
124
|
|
|
109
125
|
To work on Markdoc alone, use `pnpm --filter @markdoc/markdoc test` or
|
|
@@ -114,6 +130,18 @@ for dependencies on other workspaces. Applications should set `"private": true`.
|
|
|
114
130
|
Packages with build outputs other than `dist` should configure those outputs
|
|
115
131
|
in a package-level `turbo.json`.
|
|
116
132
|
|
|
133
|
+
The Next.js integration compiles its TypeScript source to JavaScript and type
|
|
134
|
+
declarations in `dist`. Run `pnpm exec turbo run test test:types --filter=@markdoc/next.js`
|
|
135
|
+
to build both packages and check the integration's runtime and published types.
|
|
136
|
+
|
|
137
|
+
Run `pnpm dev --filter=@markdoc/docs` to develop the documentation site using the
|
|
138
|
+
local packages. See the [app README](apps/docs/README.md) for environment and
|
|
139
|
+
deployment setup.
|
|
140
|
+
|
|
141
|
+
The projects in `apps/docs/examples/` have independent pnpm workspaces and
|
|
142
|
+
lockfiles. From an example's directory, run `pnpm install --frozen-lockfile`,
|
|
143
|
+
then follow its README to start the app. CI builds each example separately.
|
|
144
|
+
|
|
117
145
|
## Code of conduct
|
|
118
146
|
|
|
119
147
|
This project has adopted the Stripe [Code of conduct](.github/CODE_OF_CONDUCT.md).
|
package/dist/index.d.ts
CHANGED
|
@@ -2,19 +2,19 @@ import Ast from './src/ast';
|
|
|
2
2
|
import Node from './src/ast/node';
|
|
3
3
|
import format from './src/formatter';
|
|
4
4
|
import functions from './src/functions';
|
|
5
|
-
import * as nodes from './src/schema';
|
|
6
5
|
import renderers from './src/renderers';
|
|
6
|
+
import * as nodes from './src/schema';
|
|
7
7
|
import Tag from './src/tag';
|
|
8
8
|
import tags from './src/tags';
|
|
9
9
|
import { truthy } from './src/tags/conditional';
|
|
10
10
|
import Tokenizer from './src/tokenizer';
|
|
11
11
|
import transformer, { globalAttributes } from './src/transformer';
|
|
12
12
|
import transforms from './src/transforms';
|
|
13
|
+
import type { Config, ParserArgs, RenderableTreeNode, Token, ValidateError } from './src/types';
|
|
13
14
|
import { parseTags } from './src/utils';
|
|
14
15
|
import validator from './src/validator';
|
|
15
|
-
import type { Config, ParserArgs, RenderableTreeNode, Token, ValidateError } from './src/types';
|
|
16
|
-
export * from './src/types';
|
|
17
16
|
export type { TokenizerOptions } from './src/tokenizer';
|
|
17
|
+
export * from './src/types';
|
|
18
18
|
export declare function parse(content: string | Token[], args?: string | ParserArgs): Node;
|
|
19
19
|
export declare function resolve<C extends Config = Config>(content: Node, config: C): Node;
|
|
20
20
|
export declare function resolve<C extends Config = Config>(content: Node[], config: C): Node[];
|
|
@@ -30,7 +30,7 @@ export declare function createElement(name: string | {
|
|
|
30
30
|
attributes: {};
|
|
31
31
|
children: any[];
|
|
32
32
|
};
|
|
33
|
-
export {
|
|
33
|
+
export { Ast, format, functions, globalAttributes, Node, nodes, parseTags, renderers, Tag, Tokenizer, tags, transformer, transforms, truthy, validator, };
|
|
34
34
|
export default class Markdoc {
|
|
35
35
|
static nodes: typeof nodes;
|
|
36
36
|
static tags: {
|
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,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OA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