Skip to content

Odd, unexcludable behavior with ISO Dates #26

Closed as duplicate
Closed as duplicate

Description

@RobTS

Initial checklist

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

  1. added
    👋 phase/newPost is being triaged automatically
    🤞 phase/openPost is being triaged manually
    and removed
    👋 phase/newPost is being triaged automatically
    on Feb 9, 2026
  2. stephenlrandall commented on May 5, 2026

    @stephenlrandall

    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.

  3. vadimkantorov commented on Oct 17, 2026

    @vadimkantorov

    5. 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.

    @stephenlrandall Would you have any suggestion of a micromark-extension-directive fork that took another choice wrt colon-starting sequences?

  4. github-actions commented on Oct 17, 2026

    @github-actions
  5. github-actions commented on Oct 30, 2026

    @github-actions
  6. added
    👎 phase/noPost cannot or will not be acted on
    and removed
    🤞 phase/openPost is being triaged manually
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    👎 phase/noPost cannot or will not be acted on🙅 no/wontfixThis is not (enough of) an issue for this project

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions