hexo-markmap
Insert a mindmap into your Hexo blog using markmap.
Install
Section titled “Install”pnpm add hexo-markmap -Dnpm install hexo-markmap --save-devyarn add hexo-markmap --dev{% markmap %}---markmap:  colorFreezeLevel: 2---# Markdown# Syntax{% endmarkmap %}Inline Options
Section titled “Inline Options”You can customize each mindmap individually in the markmap tag ({% markmap %} ... {% endmarkmap %}).
Frontmatter Options
Section titled “Frontmatter Options”Just like you use frontmatter in your Markdown files in Hexo, you can use frontmatter in the markmap tag to customize your mindmap!
All frontmatter options are optional.
- 
id: Used to define the ID of themarkmap-wrapelement. - 
markmap: Correspond to theIMarkmapJSONOptionsin the markmap project. For more details, please refer tojsonOptions. 
Tag Options
Section titled “Tag Options”You can also specify the height of the mindmap directly in the tag. By default, it will be calculated based on the content.
{% markmap 300px %}# Markdown# Syntax{% endmarkmap %}Config
Section titled “Config”Add your options to config.yml.
Directoryhexo-project
- config.yml
 Directorysource
Directory_posts/
- …
 
Convention over configuration, if you don’t need any of the following features, then you don’t need to add these configs.
By default, it works well. Each option has a default value.
Default options
Section titled “Default options”hexo_markmap:  darkThemeCssSelector: '.dark'  CDN: 'fastly'darkThemeCssSelector: Used to specify the CSS selector for the dark theme.CDN: Used to specify the CDN for Markmap. The supported values arefastly,jsdelivr,unpkg, andcustom.- If set to 
custom, thecustomCDNvalue will be used as the CDN prefix. 
- If set to 
 customCDN: Defines a custom CDN URL for Markmap. This must be a valid URL.globalOptions: Used to define global options for all mindmaps.- Correspond to the Frontmatter Options above.
 
Upgrade to hexo-markmap v2
Section titled “Upgrade to hexo-markmap v2”hexo-markmap@2 is a completely refactored version by @coderxi1 and @maxchang3. This version upgrades to the latest Markmap and introduces more customization options, including:
- Customization within a single Markmap tag using Frontmatter:
- CSS styles (custom height, width, responsive layout, etc.)
 - Markmap’s JSON Options
 
 - Automatic CDN URL generation using Markmap’s built-in URL Builder
 - Automatic generation of corresponding CDN tags based on syntax
 - Support for dark mode and fullscreen button
 - Refactored in TypeScript with test coverage
 
Note that some implementation details differ from hexo-markmap@1. If you do not require these new features, you may continue using hexo-markmap@1.
To upgrade to hexo-markmap@2, follow these steps:
- 
Install
hexo-markmap@2using your preferred package manager:Terminal window pnpm add hexo-markmap@2 -DTerminal window npm install hexo-markmap@2 --save-devTerminal window yarn add hexo-markmap@2 -D - 
Modify your
config.ymlas needed:- 
The following configuration options are no longer supported:
hexo_markmap:pjax: falsekatex: falseprism: falselockView: falsefixSVGAttrNaN: false- The new version no longer supports 
pjaxcompatibility; - KaTeX and Prism.js are now automatically detected and generate corresponding CDN tags;
 - By setting both 
panandzoomin themarkmapfrontmatter tofalse, you can achieve the same effect aslockView. 
 - The new version no longer supports 
 - 
CDNconfiguration logic has also changed:hexo_markmap:- userCDN:d3_js: https://fastly.jsdelivr.net/npm/d3@6markmap_view_js: https://fastly.jsdelivr.net/npm/markmap-view@0.2.7katex_css: https://fastly.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.cssprism_css: https://fastly.jsdelivr.net/npm/prismjs@1.25.0/themes/prism.cssCDN: 'custom'customCDN: 'https://fastly.jsdelivr.net/npm/'- The new 
CDNsetting supportsfastly,jsdelivr,unpkg, and acustomoption; - If you choose 
custom, thecustomCDNvalue will be used as the CDN prefix. 
 - The new 
 - 
Additionally, the previous
depthparameter for setting fold levels has been removed. Instead, you can use theinitialExpandLeveloption in Frontmatter. 
 - 
 - 
Update your
markmaptags in your Markdown files:- 
The
markmaptag now supports frontmatter options. You can specify the options directly in the tag, like this:{% markmap %}---markmap:colorFreezeLevel: 2---# Markdown# Syntax{% endmarkmap %} - 
You can still customize the height of the mindmap directly in the tag, by default it will be calculated based on the content:
{% markmap 300px %}{% markmap %}# Markdown# Syntax{% endmarkmap %} 
 - 
 - 
Finally, regenerate your blog.
 
Example
Section titled “Example”{% markmap %}---markmap:  colorFreezeLevel: 2---
## Links
- [Website](https://markmap.js.org/)- [GitHub](https://github.com/gera2ld/markmap)
## Related Projects
- [coc-markmap](https://github.com/gera2ld/coc-markmap) for Neovim- [markmap-vscode](https://marketplace.visualstudio.com/items?itemName=gera2ld.markmap-vscode) for VSCode- [eaf-markmap](https://github.com/emacs-eaf/eaf-markmap) for Emacs
## Features
Note that if blocks and lists appear at the same level, the lists will be ignored.
### Lists
- **strong** ~~del~~ *italic* ==highlight==- `inline code`- [x] checkbox- Katex: $x = {-b \pm \sqrt{b^2-4ac} \over 2a}$ <!-- markmap: fold -->  - [More Katex Examples](#?d=gist:af76a4c245b302206b16aec503dbe07b:katex.md)- Now we can wrap very very very very long text based on `maxWidth` option- Ordered list  1. item 1  2. item 2
### Blocks<!-- To avoid hexo treat the following as code block, we need to use a list -->- ```js  console.log('hello, JavaScript')  ```
- | Products | Price |  |-|-|  | Apple | 4 |  | Banana | 2 |
- {% endmarkmap %}Contributors
Section titled “Contributors”Thanks to all contributors🥰!
Credits
Section titled “Credits”- This project would not have been possible without markmap.
 - Originally inspired by hexo-simple-mindmap.
 - Thanks to @coderxi1 for conceiving and implementing the initial version 2!