hexo-renderer-markdown-exit 0.2.0 → 1.0.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/bun.lock +2 -2
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/renderer.ts +4 -4
- package/types/types.d.ts +1 -1
package/bun.lock
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@mdit/plugin-tab": "^0.23.0",
|
|
9
9
|
"markdown-exit": "^1.0.0-beta.6",
|
|
10
|
-
"markdown-exit-
|
|
10
|
+
"markdown-exit-shiki": "^0.1.0",
|
|
11
11
|
"markdown-it-abbr": "^2.0.0",
|
|
12
12
|
"markdown-it-anchor": "^9.2.0",
|
|
13
13
|
"markdown-it-emoji": "^3.0.0",
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
|
|
281
281
|
"markdown-exit": ["markdown-exit@1.0.0-beta.6", "", { "dependencies": { "entities": "^7.0.0", "linkify-it": "^5.0.0", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" } }, "sha512-ZYw/ztUMNkk8yHYV6ythIeGHx3TxTRhXFQD1xZSPX9mwc5N2x7hHW9c4QojfO9ZKaBkioyPVneX9d/Eey8ilww=="],
|
|
282
282
|
|
|
283
|
-
"markdown-exit-
|
|
283
|
+
"markdown-exit-shiki": ["markdown-exit-shiki@0.1.0", "", { "peerDependencies": { "typescript": "^5" } }, "sha512-EO4Gp0bxki8tgQDa4CNEzp/oP0ZoKqbE17wapjRIuT5Uejxh7JOExveNMxvVUt05IMbuwr83UTW3DeujEOYq2Q=="],
|
|
284
284
|
|
|
285
285
|
"markdown-it": ["markdown-it@14.1.0", "", { "dependencies": { "argparse": "^2.0.1", "entities": "^4.4.0", "linkify-it": "^5.0.0", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" } }, "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg=="],
|
|
286
286
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("node:path"),g=require("@mdit/plugin-tab"),h=require("markdown-exit"),m=require("markdown-
|
|
1
|
+
"use strict";const a=require("node:path"),g=require("@mdit/plugin-tab"),h=require("markdown-exit"),m=require("markdown-exit-shiki"),x=require("markdown-it-abbr"),f=require("markdown-it-anchor"),p=require("markdown-it-emoji"),k=require("markdown-it-footnote"),q=require("markdown-it-ins"),w=require("markdown-it-mark"),E=require("markdown-it-mathjax3-pro"),P=require("markdown-it-sub"),b=require("markdown-it-sup"),_=require("markdown-it-task-lists");class y{hexo;md;config;constructor(n){this.hexo=n,this.config={render_options:{breaks:!0,html:!0,langPrefix:"language-",linkify:!0,quotes:"“”‘’",typographer:!0,xhtmlOut:!1},code_options:{themes:{light:"catppuccin-latte"}},...n.config.markdown_exit},this.md=h.createMarkdownExit(this.config.render_options),this.initPlugins()}initPlugins(){console.time("MarkdownExit: Load Default Plugins"),this.config.defaultPlugins!==!1&&this.md.use(p.full).use(k).use(w).use(P).use(b).use(x).use(q).use(_).use(m,this.config.code_options).use(g.tab).use(f,this.config.anchor_options).use(E),console.timeEnd("MarkdownExit: Load Default Plugins"),console.time("MarkdownExit: Load User Plugins"),this.loadUserPlugins(),console.timeEnd("MarkdownExit: Load User Plugins")}loadUserPlugins(){const n=this.config.plugins||[];for(const r of n){const u=typeof r=="string",t=u?r:r.name,c=u?{}:r.options||{};try{const s=a.join(this.hexo.base_dir,"node_modules",t),d=require(s),l=d.default||d;this.md.use(l,c),process.env.DEBUG&&console.log(`✅ Successfully loaded plugin: ${t}`)}catch(s){console.warn(`⚠️ Failed to load plugin: ${t}`),process.env.DEBUG&&console.warn(` Error: ${s}`)}}}async render(n){return n.text?this.md.renderAsync(n.text):""}}let o=null;function M(){return o||(o=new y(hexo)),o}const e=async i=>await M().render(i);e.disableNunjucks=!!hexo.config.markdown_exit.disableNunjucks;hexo.extend.renderer.register("md","html",e);hexo.extend.renderer.register("markdown","html",e);hexo.extend.renderer.register("mkd","html",e);hexo.extend.renderer.register("mkdn","html",e);hexo.extend.renderer.register("mdwn","html",e);hexo.extend.renderer.register("mdtxt","html",e);hexo.extend.renderer.register("mdtext","html",e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hexo-renderer-markdown-exit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A Hexo renderer plugin using markdown-exit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@mdit/plugin-tab": "^0.23.0",
|
|
20
20
|
"markdown-exit": "^1.0.0-beta.6",
|
|
21
|
-
"markdown-exit-
|
|
21
|
+
"markdown-exit-shiki": "^0.1.0",
|
|
22
22
|
"markdown-it-abbr": "^2.0.0",
|
|
23
23
|
"markdown-it-anchor": "^9.2.0",
|
|
24
24
|
"markdown-it-emoji": "^3.0.0",
|
package/src/renderer.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { tab } from "@mdit/plugin-tab";
|
|
|
3
3
|
import type Hexo from "hexo";
|
|
4
4
|
import type { StoreFunctionData } from "hexo/dist/extend/renderer";
|
|
5
5
|
import { createMarkdownExit, type MarkdownExit } from "markdown-exit";
|
|
6
|
+
import code from "markdown-exit-shiki";
|
|
6
7
|
import abbr from "markdown-it-abbr";
|
|
7
8
|
import anchor from "markdown-it-anchor";
|
|
8
9
|
import { full as emoji } from "markdown-it-emoji";
|
|
@@ -13,7 +14,6 @@ import mathjax3Pro from "markdown-it-mathjax3-pro";
|
|
|
13
14
|
import sub from "markdown-it-sub";
|
|
14
15
|
import sup from "markdown-it-sup";
|
|
15
16
|
import taskLists from "markdown-it-task-lists";
|
|
16
|
-
import renderInlineCode from "markdown-exit-inline-code";
|
|
17
17
|
|
|
18
18
|
import type { MarkdownExitConfig, PluginConfig } from "../types/types";
|
|
19
19
|
|
|
@@ -34,9 +34,9 @@ export class MarkdownRenderer {
|
|
|
34
34
|
typographer: true,
|
|
35
35
|
xhtmlOut: false,
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
code_options: {
|
|
38
38
|
themes: {
|
|
39
|
-
light: "catppuccin-latte"
|
|
39
|
+
light: "catppuccin-latte",
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
...hexo.config.markdown_exit,
|
|
@@ -59,7 +59,7 @@ export class MarkdownRenderer {
|
|
|
59
59
|
.use(abbr)
|
|
60
60
|
.use(ins)
|
|
61
61
|
.use(taskLists)
|
|
62
|
-
.use(
|
|
62
|
+
.use(code, this.config.code_options)
|
|
63
63
|
// @ts-expect-error: MarkdownExit is compatible with MarkdownIt at runtime but types mismatch
|
|
64
64
|
.use(tab)
|
|
65
65
|
// @ts-expect-error: MarkdownExit is compatible with MarkdownIt at runtime but types mismatch
|
package/types/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ interface MarkdownExitConfig {
|
|
|
6
6
|
defaultPlugins?: boolean;
|
|
7
7
|
plugins?: PluginConfig[];
|
|
8
8
|
render_options?: MarkdownExitOptions;
|
|
9
|
-
|
|
9
|
+
code_options?: InlineCodeOptions;
|
|
10
10
|
anchor_options?: AnchorOptions;
|
|
11
11
|
disableNunjucks?: boolean;
|
|
12
12
|
}
|