@ox-content/unplugin 0.17.0 → 1.1.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.
@@ -1,8 +1,7 @@
1
- import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.js";
2
- import * as unplugin0 from "unplugin";
1
+ import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
2
+ import * as unplugin$1 from "unplugin";
3
3
 
4
4
  //#region src/esbuild.d.ts
5
-
6
- declare const _default: (options?: OxContentOptions | undefined) => unplugin0.EsbuildPlugin;
5
+ declare const _default: (options?: OxContentOptions | undefined) => unplugin$1.EsbuildPlugin;
7
6
  //#endregion
8
7
  export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
@@ -0,0 +1,8 @@
1
+ import { t as unplugin } from "./src.mjs";
2
+ //#region src/esbuild.ts
3
+ /**
4
+ * esbuild plugin export for @ox-content/unplugin
5
+ */
6
+ var esbuild_default = unplugin.esbuild;
7
+ //#endregion
8
+ export { esbuild_default as default, unplugin };
@@ -1,8 +1,6 @@
1
- import * as unplugin0 from "unplugin";
2
1
  import MarkdownIt from "markdown-it";
3
2
 
4
3
  //#region src/types.d.ts
5
-
6
4
  /**
7
5
  * Markdown-it plugin function type.
8
6
  */
@@ -27,6 +25,13 @@ type RehypePlugin = [unknown, unknown] | unknown;
27
25
  * Transforms HTML after rendering.
28
26
  */
29
27
  type OxContentPlugin = (html: string) => string | Promise<string>;
28
+ interface CodeAnnotationsOptions {
29
+ metaKey?: string;
30
+ }
31
+ interface ResolvedCodeAnnotationsOptions {
32
+ enabled: boolean;
33
+ metaKey: string;
34
+ }
30
35
  /**
31
36
  * API documentation generation configuration.
32
37
  * Similar to cargo docs for Rust.
@@ -142,6 +147,12 @@ interface OxContentOptions {
142
147
  * @default 'github-dark'
143
148
  */
144
149
  highlightTheme?: string;
150
+ /**
151
+ * Opt-in line annotations for fenced code blocks.
152
+ * Example: `annotate="highlight:1,3-4;warning:6"`
153
+ * @default false
154
+ */
155
+ codeAnnotations?: boolean | CodeAnnotationsOptions;
145
156
  /**
146
157
  * Enable mermaid diagram rendering.
147
158
  * @default false
@@ -212,6 +223,7 @@ interface ResolvedOptions {
212
223
  strikethrough: boolean;
213
224
  highlight: boolean;
214
225
  highlightTheme: string;
226
+ codeAnnotations: ResolvedCodeAnnotationsOptions;
215
227
  mermaid: boolean;
216
228
  frontmatter: boolean;
217
229
  toc: boolean;
@@ -255,6 +267,6 @@ declare function transformMarkdown(source: string, filePath: string, options: Re
255
267
  /**
256
268
  * The unplugin instance.
257
269
  */
258
- declare const unplugin: unplugin0.UnpluginInstance<OxContentOptions | undefined, boolean>;
270
+ declare const unplugin: unplugin.UnpluginInstance<OxContentOptions | undefined, boolean>;
259
271
  //#endregion
260
272
  export { OxContentOptions as a, RehypePlugin as c, ResolvedOptions as d, TocEntry as f, MarkdownItPlugin as i, RemarkPlugin as l, transformMarkdown as n, OxContentPlugin as o, TransformResult as p, DocsConfig as r, PluginConfig as s, unplugin as t, ResolvedDocsConfig as u };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { n as transformMarkdown, t as unplugin } from "./src.mjs";
2
+ export { unplugin as default, unplugin, transformMarkdown };
@@ -1,2 +1,2 @@
1
- import { a as OxContentOptions, c as RehypePlugin, d as ResolvedOptions, f as TocEntry, i as MarkdownItPlugin, l as RemarkPlugin, n as transformMarkdown, o as OxContentPlugin, p as TransformResult, r as DocsConfig, s as PluginConfig, t as unplugin, u as ResolvedDocsConfig } from "./index.js";
1
+ import { a as OxContentOptions, c as RehypePlugin, d as ResolvedOptions, f as TocEntry, i as MarkdownItPlugin, l as RemarkPlugin, n as transformMarkdown, o as OxContentPlugin, p as TransformResult, r as DocsConfig, s as PluginConfig, t as unplugin, u as ResolvedDocsConfig } from "./index.mjs";
2
2
  export { DocsConfig, MarkdownItPlugin, OxContentOptions, OxContentPlugin, PluginConfig, RehypePlugin, RemarkPlugin, ResolvedDocsConfig, ResolvedOptions, TocEntry, TransformResult, unplugin as default, unplugin, transformMarkdown };
@@ -1,8 +1,7 @@
1
- import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.js";
2
- import * as unplugin4 from "unplugin";
1
+ import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
2
+ import * as unplugin$1 from "unplugin";
3
3
 
4
4
  //#region src/rollup.d.ts
5
-
6
- declare const _default: (options?: OxContentOptions | undefined) => unplugin4.RollupPlugin<any> | unplugin4.RollupPlugin<any>[];
5
+ declare const _default: (options?: OxContentOptions | undefined) => unplugin$1.RollupPlugin<any> | unplugin$1.RollupPlugin<any>[];
7
6
  //#endregion
8
7
  export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
@@ -0,0 +1,8 @@
1
+ import { t as unplugin } from "./src.mjs";
2
+ //#region src/rollup.ts
3
+ /**
4
+ * Rollup plugin export for @ox-content/unplugin
5
+ */
6
+ var rollup_default = unplugin.rollup;
7
+ //#endregion
8
+ export { rollup_default as default, unplugin };
@@ -1,7 +1,6 @@
1
- import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.js";
1
+ import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
2
2
 
3
3
  //#region src/rspack.d.ts
4
-
5
4
  declare const _default: (options?: OxContentOptions | undefined) => RspackPluginInstance;
6
5
  //#endregion
7
6
  export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
@@ -0,0 +1,8 @@
1
+ import { t as unplugin } from "./src.mjs";
2
+ //#region src/rspack.ts
3
+ /**
4
+ * Rspack plugin export for @ox-content/unplugin
5
+ */
6
+ var rspack_default = unplugin.rspack;
7
+ //#endregion
8
+ export { rspack_default as default, unplugin };
@@ -1,6 +1,5 @@
1
1
  import { createUnplugin } from "unplugin";
2
2
  import { createFilter } from "@rollup/pluginutils";
3
-
4
3
  //#region src/transform.ts
5
4
  /**
6
5
  * Transforms Markdown content into a JavaScript module.
@@ -14,7 +13,7 @@ async function transformMarkdown(source, filePath, options) {
14
13
  try {
15
14
  napi = await import("@ox-content/napi");
16
15
  } catch {
17
- throw new Error("[ox-content] Failed to load @ox-content/napi. Please ensure the NAPI module is built. Run: pnpm build:napi");
16
+ throw new Error("[ox-content] Failed to load @ox-content/napi. Please ensure the NAPI module is built. Run: nix develop -c vp run build:napi");
18
17
  }
19
18
  const result = napi.transform(source, {
20
19
  gfm: options.gfm,
@@ -22,7 +21,9 @@ async function transformMarkdown(source, filePath, options) {
22
21
  task_lists: options.taskLists,
23
22
  tables: options.tables,
24
23
  strikethrough: options.strikethrough,
25
- toc_max_depth: options.tocMaxDepth
24
+ toc_max_depth: options.tocMaxDepth,
25
+ code_annotations: options.codeAnnotations.enabled,
26
+ code_annotation_meta_key: options.codeAnnotations.metaKey
26
27
  });
27
28
  if (result.errors.length > 0) console.warn("[ox-content] Transform warnings:", result.errors);
28
29
  let frontmatter;
@@ -84,7 +85,6 @@ export default {
84
85
  };
85
86
  `;
86
87
  }
87
-
88
88
  //#endregion
89
89
  //#region src/index.ts
90
90
  /**
@@ -169,6 +169,7 @@ function resolveOptions(options) {
169
169
  strikethrough: options.strikethrough ?? true,
170
170
  highlight: options.highlight ?? false,
171
171
  highlightTheme: options.highlightTheme ?? "github-dark",
172
+ codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
172
173
  mermaid: options.mermaid ?? false,
173
174
  frontmatter: options.frontmatter ?? true,
174
175
  toc: options.toc ?? true,
@@ -185,6 +186,20 @@ function resolveOptions(options) {
185
186
  docs: resolveDocsConfig(options.docs)
186
187
  };
187
188
  }
189
+ function resolveCodeAnnotationsOptions(options) {
190
+ if (!options) return {
191
+ enabled: false,
192
+ metaKey: "annotate"
193
+ };
194
+ if (options === true) return {
195
+ enabled: true,
196
+ metaKey: "annotate"
197
+ };
198
+ return {
199
+ enabled: true,
200
+ metaKey: options.metaKey ?? "annotate"
201
+ };
202
+ }
188
203
  /**
189
204
  * Check if the file should be processed.
190
205
  */
@@ -238,7 +253,5 @@ const unpluginFactory = (rawOptions = {}) => {
238
253
  * The unplugin instance.
239
254
  */
240
255
  const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
241
- var src_default = unplugin;
242
-
243
256
  //#endregion
244
- export { unplugin as n, transformMarkdown as r, src_default as t };
257
+ export { transformMarkdown as n, unplugin as t };
@@ -1,8 +1,7 @@
1
- import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.js";
2
- import * as unplugin2 from "unplugin";
1
+ import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
2
+ import * as unplugin$1 from "unplugin";
3
3
 
4
4
  //#region src/vite.d.ts
5
-
6
- declare const _default: (options?: OxContentOptions | undefined) => unplugin2.VitePlugin<any> | unplugin2.VitePlugin<any>[];
5
+ declare const _default: (options?: OxContentOptions | undefined) => unplugin$1.VitePlugin<any> | unplugin$1.VitePlugin<any>[];
7
6
  //#endregion
8
7
  export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
package/dist/vite.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import { t as unplugin } from "./src.mjs";
2
+ //#region src/vite.ts
3
+ /**
4
+ * Vite plugin export for @ox-content/unplugin
5
+ */
6
+ var vite_default = unplugin.vite;
7
+ //#endregion
8
+ export { vite_default as default, unplugin };
@@ -1,8 +1,7 @@
1
- import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.js";
2
- import * as unplugin1 from "unplugin";
1
+ import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
2
+ import * as unplugin$1 from "unplugin";
3
3
 
4
4
  //#region src/webpack.d.ts
5
-
6
- declare const _default: (options?: OxContentOptions | undefined) => unplugin1.WebpackPluginInstance;
5
+ declare const _default: (options?: OxContentOptions | undefined) => unplugin$1.WebpackPluginInstance;
7
6
  //#endregion
8
7
  export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
@@ -0,0 +1,8 @@
1
+ import { t as unplugin } from "./src.mjs";
2
+ //#region src/webpack.ts
3
+ /**
4
+ * Webpack plugin export for @ox-content/unplugin
5
+ */
6
+ var webpack_default = unplugin.webpack;
7
+ //#endregion
8
+ export { webpack_default as default, unplugin };
package/package.json CHANGED
@@ -1,39 +1,59 @@
1
1
  {
2
2
  "name": "@ox-content/unplugin",
3
- "version": "0.17.0",
3
+ "version": "1.1.0",
4
4
  "description": "Universal plugin for Ox Content - Markdown processing for webpack, rollup, esbuild, vite, and more",
5
+ "keywords": [
6
+ "esbuild",
7
+ "markdown",
8
+ "ox-content",
9
+ "rollup",
10
+ "unplugin",
11
+ "vite",
12
+ "webpack"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "ubugeeei",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/ubugeeei/ox-content.git",
19
+ "directory": "npm/unplugin-ox-content"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
5
24
  "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
25
+ "main": "./dist/index.mjs",
26
+ "types": "./dist/index2.d.mts",
8
27
  "exports": {
9
28
  ".": {
10
- "import": "./dist/index.js",
11
- "types": "./dist/index.d.ts"
29
+ "import": "./dist/index.mjs",
30
+ "types": "./dist/index2.d.mts"
12
31
  },
13
32
  "./vite": {
14
- "import": "./dist/vite.js",
15
- "types": "./dist/vite.d.ts"
33
+ "import": "./dist/vite.mjs",
34
+ "types": "./dist/vite.d.mts"
16
35
  },
17
36
  "./webpack": {
18
- "import": "./dist/webpack.js",
19
- "types": "./dist/webpack.d.ts"
37
+ "import": "./dist/webpack.mjs",
38
+ "types": "./dist/webpack.d.mts"
20
39
  },
21
40
  "./rollup": {
22
- "import": "./dist/rollup.js",
23
- "types": "./dist/rollup.d.ts"
41
+ "import": "./dist/rollup.mjs",
42
+ "types": "./dist/rollup.d.mts"
24
43
  },
25
44
  "./esbuild": {
26
- "import": "./dist/esbuild.js",
27
- "types": "./dist/esbuild.d.ts"
45
+ "import": "./dist/esbuild.mjs",
46
+ "types": "./dist/esbuild.d.mts"
28
47
  },
29
48
  "./rspack": {
30
- "import": "./dist/rspack.js",
31
- "types": "./dist/rspack.d.ts"
49
+ "import": "./dist/rspack.mjs",
50
+ "types": "./dist/rspack.d.mts"
32
51
  }
33
52
  },
34
- "files": [
35
- "dist"
36
- ],
53
+ "publishConfig": {
54
+ "access": "public",
55
+ "provenance": true
56
+ },
37
57
  "dependencies": {
38
58
  "@rollup/pluginutils": "^5.1.4",
39
59
  "gray-matter": "^4.0.3",
@@ -44,42 +64,22 @@
44
64
  "remark-rehype": "^11.1.1",
45
65
  "unified": "^11.0.5",
46
66
  "unplugin": "^2.1.2",
47
- "@ox-content/napi": "0.17.0"
67
+ "@ox-content/napi": "1.1.0"
48
68
  },
49
69
  "devDependencies": {
50
70
  "@types/markdown-it": "^14.1.2",
51
71
  "@types/node": "^22.0.0",
52
- "tsdown": "^0.12.0",
53
72
  "@typescript/native-preview": "^7.0.0-dev.20250601",
54
- "typescript": "^5.7.0",
55
- "vite": "^8.0.0",
56
- "webpack": "^5.97.1",
73
+ "esbuild": "^0.27.4",
57
74
  "rollup": "^4.29.1",
58
- "esbuild": "^0.27.4"
59
- },
60
- "keywords": [
61
- "unplugin",
62
- "vite",
63
- "webpack",
64
- "rollup",
65
- "esbuild",
66
- "markdown",
67
- "ox-content"
68
- ],
69
- "license": "MIT",
70
- "author": "ubugeeei",
71
- "repository": {
72
- "type": "git",
73
- "url": "https://github.com/ubugeeei/ox-content.git",
74
- "directory": "npm/unplugin-ox-content"
75
- },
76
- "publishConfig": {
77
- "provenance": true,
78
- "access": "public"
75
+ "typescript": "^5.7.0",
76
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.11",
77
+ "vite-plus": "0.1.11",
78
+ "webpack": "^5.97.1"
79
79
  },
80
80
  "scripts": {
81
- "build": "tsdown",
82
- "dev": "tsdown --watch",
81
+ "build": "vp pack",
82
+ "dev": "vp pack --watch",
83
83
  "typecheck": "tsgo --noEmit"
84
84
  }
85
85
  }
package/dist/esbuild.js DELETED
@@ -1,10 +0,0 @@
1
- import { t as src_default } from "./src.js";
2
-
3
- //#region src/esbuild.ts
4
- /**
5
- * esbuild plugin export for @ox-content/unplugin
6
- */
7
- var esbuild_default = src_default.esbuild;
8
-
9
- //#endregion
10
- export { esbuild_default as default, src_default as unplugin };
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- import { n as unplugin, r as transformMarkdown, t as src_default } from "./src.js";
2
-
3
- export { src_default as default, transformMarkdown, unplugin };
package/dist/rollup.js DELETED
@@ -1,10 +0,0 @@
1
- import { t as src_default } from "./src.js";
2
-
3
- //#region src/rollup.ts
4
- /**
5
- * Rollup plugin export for @ox-content/unplugin
6
- */
7
- var rollup_default = src_default.rollup;
8
-
9
- //#endregion
10
- export { rollup_default as default, src_default as unplugin };
package/dist/rspack.js DELETED
@@ -1,10 +0,0 @@
1
- import { t as src_default } from "./src.js";
2
-
3
- //#region src/rspack.ts
4
- /**
5
- * Rspack plugin export for @ox-content/unplugin
6
- */
7
- var rspack_default = src_default.rspack;
8
-
9
- //#endregion
10
- export { rspack_default as default, src_default as unplugin };
package/dist/vite.js DELETED
@@ -1,10 +0,0 @@
1
- import { t as src_default } from "./src.js";
2
-
3
- //#region src/vite.ts
4
- /**
5
- * Vite plugin export for @ox-content/unplugin
6
- */
7
- var vite_default = src_default.vite;
8
-
9
- //#endregion
10
- export { vite_default as default, src_default as unplugin };
package/dist/webpack.js DELETED
@@ -1,10 +0,0 @@
1
- import { t as src_default } from "./src.js";
2
-
3
- //#region src/webpack.ts
4
- /**
5
- * Webpack plugin export for @ox-content/unplugin
6
- */
7
- var webpack_default = src_default.webpack;
8
-
9
- //#endregion
10
- export { webpack_default as default, src_default as unplugin };