Skip to content

Apply directives only on tags starting with a letter #28

Closed as duplicate

Description

@radarfox

Initial checklist

Problem

Our users are reporting problems with writing time values. E.g. the value "12:30pm" is transformed to 12<30pm /> after parsing it with this plugin and converting it to HTML. This will result in displaying just "12" when we will pass this through sanitization that discards unknown tags. Without the sanitization it will throw the error Invalid tag: 30pm and fail to render the text.

I know, that the current recommendation to handle this is to add the escape character like this: "12:30pm", but our users will usualy forget about this or they even don't know about it and they are confused by the missing text.

Moreover, the HTML specification actually forbids the tag names to start with anything else than a letter. So, it seems to me, that trying to interpret such syntax as tag names, doesn't make sense.

document.createElement('30pm');
VM2075:1 Uncaught InvalidCharacterError: Failed to execute 'createElement' on 'Document': The tag name provided ('30pm') is not a valid name.

Current solutions

To fix this I would have to create a new remark plugin, that would be ran after remark-directive, that would go through all directives, check their tag names and revert those not starting with a letter back to the plain text.

Proposed solutions

Alter the directives parsing algorhitm to only create directives, if the directive name is starting with a letter.

Activity

  1. added
    👋 phase/newPost is being triaged automatically
    🤞 phase/openPost is being triaged manually
    and removed
    👋 phase/newPost is being triaged automatically
    on Mar 11, 2026
  2. github-actions commented on Mar 11, 2026

    @github-actions
  3. github-actions commented on Mar 11, 2026

    @github-actions

    Hi! Thanks for reaching out! Because we treat issues as our backlog, we close issues that are questions since they don’t represent a task to be completed.

    See our support docs for how and where to ask questions.

    Thanks,
    — bb

  4. added
    👎 phase/noPost cannot or will not be acted on
    and removed
    🤞 phase/openPost is being triaged manually
    on Mar 11, 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/questionThis does not need any changes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions