
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
@toycode/markdown-it-class
Advanced tools
This is a plugin for the markdown-it markdown parser. This plugin add class attributes to html elements.
npm install @toycode/markdown-it-class --save-dev
Although it will work with "yarn", I have not tried it.
Use
---
### Add title class to h1 element
const MarkdownIt = require('markdown-it') const markdownItClass = require('@toycode/markdown-it-class')
const mdText = '# Hello' const mapping = { h1: 'title' } const md = MarkdownIt().use(markdownItClass, mapping) console.log(md.render(mdText)) //
### Add more than one classes
```js
const MarkdownIt = require('markdown-it')
const markdownItClass = require('@toycode/markdown-it-class')
const mdText = '# Hello\n## *Markdown* world'
const mapping = { h1: ['title', 'is-4'], h2: 'subtitle', em: 'tag' }
const md = MarkdownIt().use(markdownItClass, mapping)
console.log(md.render(mdText))
// <h1 class="title is-4">Hello</h1>
// <h2 class="subtitle"><em class="tag">Markdown</em> world</h2>
FAQs
A markdown-it plugin that add classes by tag name
The npm package @toycode/markdown-it-class receives a total of 5,975 weekly downloads. As such, @toycode/markdown-it-class popularity was classified as popular.
We found that @toycode/markdown-it-class 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.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.