hexo-renderer-markdown-exit 1.0.1 → 2.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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +3 -2
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-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);
1
+ "use strict";const a=require("node:path"),m=require("@mdit/plugin-tab"),g=require("markdown-exit"),h=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"),_=require("markdown-it-sup"),b=require("markdown-it-task-lists"),y=require("markdown-exit-mermaid");class j{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"}},mermaid_options:{theme:"default",js_url:"/css/host/mermaid/mermaid.min.js"},...n.config.markdown_exit},this.md=g.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(_).use(x).use(q).use(b).use(h,this.config.code_options).use(y,this.config.mermaid_options).use(m.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 i=null;function M(){return i||(i=new j(hexo)),i}const e=async o=>await M().render(o);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": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "description": "A Hexo renderer plugin using markdown-exit",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [
@@ -22,7 +22,8 @@
22
22
  "dependencies": {
23
23
  "@mdit/plugin-tab": "^0.23.0",
24
24
  "markdown-exit": "^1.0.0-beta.6",
25
- "markdown-exit-shiki": "^0.1.1",
25
+ "markdown-exit-mermaid": "^1.0.1",
26
+ "markdown-exit-shiki": "^0.1.4",
26
27
  "markdown-it-abbr": "^2.0.0",
27
28
  "markdown-it-anchor": "^9.2.0",
28
29
  "markdown-it-emoji": "^3.0.0",