Customize Markdown by ssshooter/mind-elixir-core
npx skills add https://github.com/ssshooter/mind-elixir-core --skill 'Customize Markdown'Mind Elixir 支持在节点中渲染 Markdown。您可以使用内置的简易解析器,或集成功能完整的 Markdown 库。
默认情况下,Mind Elixir 不会 解析 Markdown。您必须在选项中提供一个解析函数来启用此功能。
如果您只需要基本的格式(粗体、斜体、代码),可以实现一个简单的替换函数。
let mind = new MindElixir({
// ... 其他选项
markdown: text => {
// 简单的正则表达式替换
return text
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
.replace(/\*(.*?)\*/g, '<em>$1</em>')
.replace(/`(.*?)`/g, '<code>$1</code>')
},
})
为了获得完整的 Markdown 支持,建议使用像 marked 或 markdown-it 这样的库。
marked 的示例首先,安装该库:
npm i marked
然后,在您的初始化代码中使用它:
import { marked } from 'marked'
import MindElixir from 'mind-elixir'
let mind = new MindElixir({
// ... 其他选项
markdown: text => marked(text),
})
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
这将把节点内容渲染为由 Markdown 解析器生成的 HTML。
每周安装量
–
代码仓库
GitHub 星标数
3.0K
首次出现
–
安全审计
Mind Elixir supports markdown rendering in nodes. You can use the built-in simple parser or integrate a full-featured markdown library.
By default, Mind Elixir does not parse markdown. You must provide a parsing function in the options to enable it.
You can implement a simple replacement function if you only need basic formatting (bold, italic, code).
let mind = new MindElixir({
// ... other options
markdown: text => {
// Simple regex replacements
return text
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
.replace(/\*(.*?)\*/g, '<em>$1</em>')
.replace(/`(.*?)`/g, '<code>$1</code>')
},
})
For full markdown support, it is recommended to use a library like marked or markdown-it.
markedFirst, install the library:
npm i marked
Then, use it in your initialization:
import { marked } from 'marked'
import MindElixir from 'mind-elixir'
let mind = new MindElixir({
// ... other options
markdown: text => marked(text),
})
This will render the node content as HTML generated by the markdown parser.
Weekly Installs
–
Repository
GitHub Stars
3.0K
First Seen
–
Security Audits
Vue 3 调试指南:解决响应式、计算属性与监听器常见错误
11,400 周安装