hexo-renderer-markdown-exit 3.1.1 → 3.1.2
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 +7 -20
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,29 +13,16 @@ markdown_exit:
|
|
|
13
13
|
typographer: true
|
|
14
14
|
quotes: "“”‘’"
|
|
15
15
|
plugins:
|
|
16
|
-
- markdown-it-obsidian-callouts
|
|
17
|
-
- name: markdown-
|
|
16
|
+
- name: markdown-it-obsidian-callouts
|
|
17
|
+
- name: "markdown-exit-image"
|
|
18
18
|
options:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
dark: catppuccin-mocha
|
|
22
|
-
nord: nord
|
|
23
|
-
tokyo: tokyo-night
|
|
19
|
+
supported_domains: ["assets.example.com"]
|
|
20
|
+
cache_path: ./thumbcache.json
|
|
24
21
|
disableNunjucks: false
|
|
25
22
|
```
|
|
26
23
|
|
|
27
|
-
## Development
|
|
28
|
-
|
|
29
|
-
```shell
|
|
30
|
-
# install dependencies
|
|
31
|
-
bun i
|
|
32
|
-
# build the project
|
|
33
|
-
just build
|
|
34
|
-
# after modifying the code, run lint
|
|
35
|
-
just check
|
|
36
|
-
```
|
|
37
|
-
|
|
38
24
|
## Know Issues
|
|
39
25
|
|
|
40
|
-
- [
|
|
41
|
-
|
|
26
|
+
- Markdown content in "hexo custom tags"[^1] is not processed correctly.
|
|
27
|
+
|
|
28
|
+
[^1]: https://hexo.io/docs/tag-plugins
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const l=require("node:path"),h=require("@mdit/plugin-tab"),f=require("markdown-exit"),m=require("markdown-exit-mermaid"),g=require("markdown-exit-shiki"),x=require("markdown-it-abbr"),p=require("markdown-it-anchor"),k=require("markdown-it-emoji"),q=require("markdown-it-footnote"),w=require("markdown-it-ins"),P=require("markdown-it-mark"),y=require("markdown-it-mathjax3-pro"),E=require("markdown-it-sub"),_=require("markdown-it-sup"),b=require("markdown-it-task-lists");class j{hexo;md;config;constructor(e){this.hexo=e,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"},...e.config.markdown_exit},this.md=f.createMarkdownExit(this.config.render_options),this.initPlugins()}initPlugins(){console.time("MarkdownExit: Load Default Plugins"),this.config.defaultPlugins!==!1&&this.md.use(k.full).use(q).use(P).use(E).use(_).use(x).use(w).use(b).use(g,this.config.code_options).use(m,this.config.mermaid_options).use(h.tab).use(p,this.config.anchor_options).use(y),console.timeEnd("MarkdownExit: Load Default Plugins"),console.time("MarkdownExit: Load User Plugins"),this.loadUserPlugins(),console.timeEnd("MarkdownExit: Load User Plugins")}resolvePluginFunction(e){if(typeof e.default=="function")return e.default;if(typeof e=="function")return e;if(typeof e=="object"&&e!==null){for(const t in e)if(typeof e[t]=="function")return e[t]}return e}loadUserPlugins(){const e=this.config.plugins||[];for(const t of e){const u=typeof t=="string",r=u?t:t.name,c=u?{}:t.options||{};try{const o=l.join(this.hexo.base_dir,"node_modules",r),d=require(o),a=this.resolvePluginFunction(d);this.md.use(a,c),process.env.DEBUG&&console.log(`✅ Successfully loaded plugin: ${r}`)}catch(o){console.warn(`⚠️ Failed to load plugin: ${r}`),process.env.DEBUG&&console.warn(` Error: ${o}`)}}}async render(e){return e.text?this.md.renderAsync(e.text):""}}let s=null;function M(){return s||(s=new j(hexo)),s}const n=async i=>await M().render(i);n.disableNunjucks=!!hexo.config.markdown_exit.disableNunjucks;hexo.extend.renderer.register("md","html",n);hexo.extend.renderer.register("markdown","html",n);hexo.extend.renderer.register("mkd","html",n);hexo.extend.renderer.register("mkdn","html",n);hexo.extend.renderer.register("mdwn","html",n);hexo.extend.renderer.register("mdtxt","html",n);hexo.extend.renderer.register("mdtext","html",n);
|