-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
🤞 phase/openPost is being triaged manuallyPost is being triaged manually
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- 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)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🤞 phase/openPost is being triaged manuallyPost is being triaged manually