
Company News
Socket Partners with Replit to Block Malicious Packages in AI-Powered Development
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.
micromark-extension-substitute
Advanced tools
Micromark extension for inline substitution syntax (:sub[...]{...})
micromark extension for inline substitution syntax (:sub[INITIAL]{REPLACEMENT}).
Inline substitution enables progressive disclosure — show brief content initially, reveal full content on activation. Useful for TL;DR summaries, spoilers, and interactive learning. For a complete solution, use remark-substitute.
npm install micromark-extension-substitute
import { micromark } from 'micromark'
import { sub } from 'micromark-extension-substitute'
const html = micromark(':sub[initial]{replacement}', {
extensions: [sub()],
htmlExtensions: [{
enter: {
sub() { this.tag('<span class="sub">') }
},
exit: {
subInitialData(token) {
this.tag('<span class="initial">')
this.raw(this.sliceSerialize(token))
this.tag('</span>')
},
subReplacementData(token) {
this.tag('<span class="replacement">')
this.raw(this.sliceSerialize(token))
this.tag('</span>')
},
sub() { this.tag('</span>') }
}
}]
})
// Output: <p><span class="sub"><span class="initial">initial</span><span class="replacement">replacement</span></span></p>
Note: This extension only tokenizes the syntax. You must provide an htmlExtensions handler to render output, or use remark-substitute for a complete solution.
sub — The whole constructsubMarker — The :sub[, ], {, and } markerssubInitialData — The INITIAL contentsubReplacementData — The REPLACEMENT content:sub[ (no whitespace allowed)] (with bracket balancing){ and } (with brace balancing)In INITIAL:
\] → literal ] (doesn't close)\[ → literal [ (no depth change)\\ → literal \In REPLACEMENT:
\} → literal } (doesn't close)\{ → literal { (no depth change)\\ → literal \MIT
FAQs
Micromark extension for inline substitution syntax (:sub[...]{...})
We found that micromark-extension-substitute demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.

Research
/Security News
Newer packages in this compromise use native extensions and .pth loaders to execute JavaScript stealers in developer environments.