@kubb/parser-md 5.8.2 → 5.8.4

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 CHANGED
@@ -10,7 +10,7 @@
10
10
  [![Node][node-src]][node-href]
11
11
 
12
12
  <h4>
13
- <a href="https://kubb.dev" target="_blank">Documentation</a>
13
+ <a href="https://kubb.dev/extensions/kubb-labs/parser-md" target="_blank">Documentation</a>
14
14
  <span> · </span>
15
15
  <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
16
16
  <span> · </span>
package/dist/index.cjs CHANGED
@@ -4,12 +4,12 @@ let _kubb_kit = require("@kubb/kit");
4
4
  let yaml = require("yaml");
5
5
  //#region kubb-extension.json
6
6
  var compatibility = {
7
- "kubb": ">=5.8.0",
7
+ "kubb": ">=5.8.3",
8
8
  "node": ">=22"
9
9
  };
10
10
  //#endregion
11
11
  //#region package.json
12
- var version = "5.8.2";
12
+ var version = "5.8.4";
13
13
  //#endregion
14
14
  //#region src/utils.ts
15
15
  /**
package/dist/index.js CHANGED
@@ -3,12 +3,12 @@ import { ast, defineExtension } from "@kubb/kit";
3
3
  import { stringify } from "yaml";
4
4
  //#region kubb-extension.json
5
5
  var compatibility = {
6
- "kubb": ">=5.8.0",
6
+ "kubb": ">=5.8.3",
7
7
  "node": ">=22"
8
8
  };
9
9
  //#endregion
10
10
  //#region package.json
11
- var version = "5.8.2";
11
+ var version = "5.8.4";
12
12
  //#endregion
13
13
  //#region src/utils.ts
14
14
  /**
@@ -0,0 +1,44 @@
1
+ # Options
2
+
3
+ `parserMd()` takes no options. You control its output through file metadata, such as the YAML frontmatter at the top of a generated page.
4
+
5
+ ## Frontmatter
6
+
7
+ Set `file.meta.frontmatter` inside a plugin. Any serializable object becomes a YAML block at the top of the generated page.
8
+
9
+ ::field-group
10
+
11
+ :::field{name="meta.frontmatter" type="Record<string, unknown> | null"}
12
+ YAML frontmatter prepended to the generated Markdown file.
13
+ :::
14
+
15
+ ::
16
+
17
+ ::code-group
18
+
19
+ ```typescript [plugin.ts]
20
+ import { ast } from 'kubb/kit'
21
+
22
+ const file = ast.factory.createFile({
23
+ baseName: 'README.md',
24
+ path: './src/gen/README.md',
25
+ meta: {
26
+ frontmatter: { title: 'API Reference', layout: 'doc' },
27
+ },
28
+ sources: [ast.factory.createSource({ nodes: [ast.factory.createText('# API Reference')] })],
29
+ })
30
+ ```
31
+
32
+ ```md [README.md]
33
+ ---
34
+ title: API Reference
35
+ layout: doc
36
+ ---
37
+
38
+ # API Reference
39
+ ```
40
+
41
+ ::
42
+
43
+ - `parserMd().print` accepts objects and Markdown strings, joined with blank lines.
44
+ - `parserMd().print({ title: 'Pets', layout: 'doc' })` returns `---\ntitle: Pets\nlayout: doc\n---`.
@@ -1,14 +1,16 @@
1
1
  # Markdown parser
2
2
 
3
- The Markdown parser writes `.md` and `.markdown` files. It joins a file's source blocks as plain Markdown, separated by blank lines. When the file sets `meta.frontmatter`, it adds that object as YAML frontmatter at the top.
3
+ The Markdown parser writes `.md` and `.markdown` files. It joins a file's source blocks as plain Markdown, separated by blank lines. When the file sets [`meta.frontmatter`](https://kubb.dev/extensions/kubb-labs/parser-md/options#frontmatter), it adds that object as YAML frontmatter at the top.
4
4
 
5
5
  It takes no options. Kubb registers it by default with the TypeScript parsers.
6
6
 
7
7
  ## Setup
8
8
 
9
- Add it yourself only when you set a custom `parsers` array, since that array replaces the default set. List every parser your plugins need.
9
+ Add it yourself only when you set a custom `parsers` array, since that array replaces the default set. List every parser your plugins need. Files no parser claims are written as their source text.
10
10
 
11
- ```ts
11
+ ## Example
12
+
13
+ ```typescript [kubb.config.ts]
12
14
  import { defineConfig } from 'kubb/config'
13
15
  import { parserMd } from '@kubb/parser-md'
14
16
  import { parserTs, parserTsx } from '@kubb/parser-ts'
@@ -10,9 +10,10 @@
10
10
  "light": "https://kubb.dev/feature/markdown.svg"
11
11
  },
12
12
  "tags": ["markdown", "frontmatter", "parser", "docs", "yaml"],
13
- "docs": "https://kubb.dev/parsers/parser-md",
13
+ "docs": "https://kubb.dev/extensions/kubb-labs/parser-md",
14
+ "maintainers": [{ "name": "Stijn Van Hulle", "github": "stijnvanhulle" }],
14
15
  "compatibility": {
15
- "kubb": ">=5.8.0",
16
+ "kubb": ">=5.8.3",
16
17
  "node": ">=22"
17
18
  }
18
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/parser-md",
3
- "version": "5.8.2",
3
+ "version": "5.8.4",
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",
@@ -11,7 +11,7 @@
11
11
  "parser",
12
12
  "yaml"
13
13
  ],
14
- "homepage": "https://kubb.dev/parsers/parser-md",
14
+ "homepage": "https://kubb.dev/extensions/kubb-labs/parser-md",
15
15
  "license": "MIT",
16
16
  "author": "stijnvanhulle",
17
17
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "files": [
37
37
  "dist",
38
38
  "kubb-extension.json",
39
- "OVERVIEW.md",
39
+ "docs",
40
40
  "!/**/**.test.**",
41
41
  "!/**/__tests__/**",
42
42
  "!/**/__snapshots__/**"
@@ -60,7 +60,7 @@
60
60
  "registry": "https://registry.npmjs.org/"
61
61
  },
62
62
  "dependencies": {
63
- "@kubb/kit": "5.8.2",
63
+ "@kubb/kit": "5.8.4",
64
64
  "yaml": "^2.9.1"
65
65
  },
66
66
  "engines": {