Auto-generated description drops the text between two colons in the first paragraph

Aperta Adatta ai principianti
#13,059 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@0z5a ci sta già lavorando.

Dal 15/11/2026.

  • #13060 di @0z5a — aperta
  • #13096 di @saiv0n — aperta
  • #13099 di @Ganesh1729-ui — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
markdown, node.js, react, typescript

Direzione di ricerca

Inizia con createExcerpt() in packages/docusaurus-utils/src/markdownUtils.ts e confronta il suo schema di pulizia delle emoji con lo schema degli shortcode di remark-emoji descritto nell’issue. Controlla i test esistenti dell’helper e aggiungi casi per orari, due punti nel testo, URL e shortcode delle emoji. Il lavoro è completato quando gli shortcode effettivi vengono rimossi e il resto del testo tra i due punti rimane intatto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Have you read the Contributing Guidelines on issues?
  • I have 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

When a doc, blog post or page has no description front matter, the description Docusaurus generates from the first paragraph (<meta name="description">, og:description, DocCard text on category index pages, blog feed items) loses everything between the first and the last colon of that line.

The emoji-shortcode cleanup in createExcerpt() (packages/docusaurus-utils/src/markdownUtils.ts) uses /\s?:(?:::|[^:\n])+:/g, which matches any text between two colons, spaces included, not just shortcodes like :wink:.

The Docusaurus website shows it today: https://docusaurus.io/docs/3.8.1/sidebar/items has no description front matter, and its first paragraph is "We have introduced three types of item types in the example in the previous section: doc, category, and link, whose usages are fairly intuitive. We will formally introduce their APIs. There's also a fourth type: autogenerated, which we will explain in detail later." The page ships <meta name="description" content="We have introduced three types of item types in the example in the previous section autogenerated, which we will explain in detail later."/>.

Reproducible demo

https://docusaurus.io/docs/3.8.1/sidebar/items (view the page source, description / og:description meta tags)

Steps to reproduce
  1. Open https://docusaurus.io/docs/3.8.1/sidebar/items and look at its <meta name="description">; compare it with the first paragraph of website/versioned_docs/version-3.8.1/guides/docs/sidebar/items.mdx.
  2. Or call the helper directly on main: createExcerpt('Meeting runs 10:30 to 11:45 daily.') from @docusaurus/utils returns 'Meeting runs 1045 daily.'. Docs, blog posts and pages use this excerpt as description when the front matter has none.
Expected behavior

The description keeps the sentence as written (Meeting runs 10:30 to 11:45 daily.), the same way the page body renders it. Only real emoji shortcodes such as :wink: or :+1: should be removed, matching what remark-emoji (markdown.emoji, on by default) converts: /:\+1:|:-1:|:[\w-]+:/g.

Actual behavior
  • Meeting runs 10:30 to 11:45 daily. gives Meeting runs 1045 daily.
  • Note: install first. Tip: run the build. gives Note run the build.
  • Download it from https://nodejs.org. Then run: npm ci gives Download it from https npm ci
Your environment
  • Docusaurus version used: main
  • Environment name and version: Node.js, any
  • Operating system and version: any
Self-service
  • I'd be willing to fix this bug myself.

This issue was drafted with Claude Code (claude-opus-5-5); the results above are from the runs described.

Lingua principale
TypeScript
Stelle
66.6k
Fork
10.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di facebook/docusaurus

Tutte le issue di facebook/docusaurus

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.