
Security News
Frontier AI Is Now Critical Infrastructure
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.
markdown-it-color-text
Advanced tools
npm i markdown-it-color-text
var md = require('markdown-it')()
.use(require('markdown-it-color-text'))
你可以在引用项目时添加配置项,以下为全部的默认配置:
var md = require('markdown-it')()
.use(require('markdown-it-color-text'), {
classPrefix: 'md-color', // default
inlineStyle: false, // default
customColor: {} // default
})
classPrefix可以自定义class前缀,可以在项目中自定义样式:var md = require('markdown-it')()
.use(require('markdown-it-color-text'), {
classPrefix: 'hello-world'
})
md.render('{primary}(sample)')
// => '<span class="hello-world hello-world--primary">sample</span>'
customColor可以预定义颜色:var md = require('markdown-it')()
.use(require('markdown-it-color-text'), {
customColor: {
primary: '#409EFF',
success: '#67C23A',
warning: '#E6A23C',
info: '#909399',
danger: '#F56C6C'
}
})
md.render('{primary}(sample)')
// => '<span class="md-color md-color--primary" style="color: #409EFF;">sample</span>'
// 组件读取到customColor配置后,当检测到已知配置项的颜色代码时,会自动添加相应的行内样式
设置inlineStyle为true可以为当前行添加行内样式:
var md = require('markdown-it')()
.use(require('markdown-it-color-text'), {
inlineStyle: true,
})
md.render('{#f80}(sample)')
// => '<span class="md-color" style="color: #f80;">sample</span>'
// 注意:组件已设置为仅检测16进制颜色代码
FAQs
Inline color plugin for markdown-it
The npm package markdown-it-color-text receives a total of 0 weekly downloads. As such, markdown-it-color-text popularity was classified as not popular.
We found that markdown-it-color-text demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.