You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Affected package
remark-directive@4.0.0
Steps to reproduce
Sample code that produces weird output that tends to break on pages:
import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkDirective from 'remark-directive';
import remarkDirectiveRehype from 'remark-directive-rehype';
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';
import rehypeComponents from 'rehype-components';
async function main() {
const file = await unified()
.use(remarkParse)
.use(remarkDirective)
.use(remarkDirectiveRehype)
.use(remarkRehype)
.use(rehypeComponents, {
components: {},
})
.use(rehypeStringify)
.process('2026-01-29T07:13:47.942Z');
console.log(String(file));
}
main();
Actual behavior
The resulting output equates to <p>2026-01-29T07:13<47></47>.942Z</p>, as remarkDirective interprets the seconds as a directive, then remarkDirectiveRehype turns it into its own, non-existant <47> Tag. This breaks in React environments.
I can't seem to be able to limit directive interpretations to a whitelist, either, to leave ISO Dates untouched.
Expected behavior
ISO Dates should either be ignored by the parser, or there should be a way to limit directive interpretations to a whitelist (e.g. ['youtube', 'xyz'].
Runtime
node@24.11.1
Package manager
yarn@4.2.1
Operating system
macOS Tahoe 26.2
Build and bundle tools
Next.js, other (please specify in steps to reproduce)
Activity
stephenlrandall commentedon May 5, 2026
This will likely not be addressed (see the closed issues in this repo), but you can escape the colon to have it ignored by the directive processor.
vadimkantorov commentedon Oct 17, 2026
@stephenlrandall Would you have any suggestion of a micromark-extension-directive fork that took another choice wrt colon-starting sequences?
github-actions commentedon Oct 17, 2026
github-actions commentedon Oct 30, 2026