@kubb/parser-md 5.8.4 → 5.9.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.cjs +1 -1
- package/dist/index.js +1 -1
- package/docs/options.md +2 -2
- package/docs/overview.md +20 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/docs/options.md
CHANGED
|
@@ -25,7 +25,7 @@ const file = ast.factory.createFile({
|
|
|
25
25
|
meta: {
|
|
26
26
|
frontmatter: { title: 'API Reference', layout: 'doc' },
|
|
27
27
|
},
|
|
28
|
-
sources: [ast.factory.createSource({ nodes: [ast.factory.createText('
|
|
28
|
+
sources: [ast.factory.createSource({ nodes: [ast.factory.createText('Endpoints generated from the OpenAPI spec.')] })],
|
|
29
29
|
})
|
|
30
30
|
```
|
|
31
31
|
|
|
@@ -35,7 +35,7 @@ title: API Reference
|
|
|
35
35
|
layout: doc
|
|
36
36
|
---
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Endpoints generated from the OpenAPI spec.
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
::
|
package/docs/overview.md
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
# Markdown
|
|
1
|
+
# Markdown
|
|
2
2
|
|
|
3
|
-
The Markdown parser
|
|
4
|
-
|
|
5
|
-
It takes no options. Kubb registers it by default with the TypeScript parsers.
|
|
3
|
+
The Markdown parser joins a file's source blocks as plain Markdown, separated by blank lines. When a file sets `meta.frontmatter`, the parser writes that object as YAML frontmatter above the content, after the file banner if one is set.
|
|
6
4
|
|
|
7
5
|
## Setup
|
|
8
6
|
|
|
9
|
-
Add it yourself only when you set a custom `parsers` array,
|
|
7
|
+
With `defineConfig` from `kubb/config`, Kubb registers the parser by default, next to `parserTs` and `parserTsx`, so no setup is needed. Bundler integrations leave it out. Add it yourself only when you set a custom `parsers` array, because that array replaces the default set. List every parser your plugins need. Files that no parser claims are written as their source text only, without imports, exports, banner, or footer.
|
|
8
|
+
|
|
9
|
+
## Options worth knowing
|
|
10
|
+
|
|
11
|
+
The parser takes no options. Plugins control the output through `meta.frontmatter` on each file, and an empty object writes none.
|
|
12
|
+
|
|
13
|
+
See [Options](https://kubb.dev/extensions/kubb-labs/parser-md/options) for how a plugin sets frontmatter.
|
|
10
14
|
|
|
11
15
|
## Example
|
|
12
16
|
|
|
17
|
+
The config below sets a custom `parsers` array and keeps the Markdown parser in it.
|
|
18
|
+
|
|
13
19
|
```typescript [kubb.config.ts]
|
|
14
20
|
import { defineConfig } from 'kubb/config'
|
|
15
21
|
import { parserMd } from '@kubb/parser-md'
|
|
16
22
|
import { parserTs, parserTsx } from '@kubb/parser-ts'
|
|
23
|
+
import { pluginTs } from '@kubb/plugin-ts'
|
|
17
24
|
|
|
18
25
|
export default defineConfig({
|
|
19
26
|
input: './petStore.yaml',
|
|
20
27
|
output: { path: './src/gen' },
|
|
21
|
-
parsers: [
|
|
22
|
-
|
|
28
|
+
parsers: [
|
|
29
|
+
parserTs(),
|
|
30
|
+
parserTsx(),
|
|
31
|
+
parserMd(),
|
|
32
|
+
],
|
|
33
|
+
plugins: [
|
|
34
|
+
pluginTs(),
|
|
35
|
+
],
|
|
23
36
|
})
|
|
24
37
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/parser-md",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
4
4
|
"description": "Markdown source file parser for Kubb. Converts the universal AST to `.md` source and renders YAML frontmatter via the `print` helper.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codegen",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"registry": "https://registry.npmjs.org/"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@kubb/kit": "5.
|
|
63
|
+
"@kubb/kit": "5.9.0",
|
|
64
64
|
"yaml": "^2.9.1"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|