Skip to content

DocCard automatically detects digits as emoji, causing weird rendering #12071

@ian-rehwinkel-lablions

Description

@ian-rehwinkel-lablions

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

Due to the Regex used here, digits are recognized as Emojis. This is because for some reason /\p{Emoji}/u.test("1") === true.
Unfortunately, this causes the following behavior when the title of a page starts with a number (in this case 11).

Image

Reproducible demo

https://stackblitz.com/edit/github-intrjsrr

Steps to reproduce

Add to frontmatter:

---
title: 11 Something
...
---

Look at DocCard generated for this page.

Expected behavior

Number should be recognized as Text and therefore not be used as the icon.

Actual behavior

The number is recognized as an emoji, making it the icon in the DocCard.

Your environment

No response

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions