Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in v3: admonitions in nested lists are not recognized as markup elements #9507

Closed
6 of 7 tasks
hrumhurum opened this issue Nov 5, 2023 · 2 comments · Fixed by #9535
Closed
6 of 7 tasks
Labels
bug An error in the Docusaurus core causing instability or issues with its execution domain: markdown Related to Markdown parsing or syntax

Comments

@hrumhurum
Copy link

hrumhurum commented Nov 5, 2023

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

Docusaurus v3.0.0 has a regression in admonitions handling when they are placed inside a list. They are not treated as markup elements while admonitions placed outside of the list are treated correctly.

Reproducible demo

https://stackblitz.com/edit/github-42617b?file=docs%2Fintro.md

Steps to reproduce

1. Item 1

2. Item 2

   :::info Important Considerations
   For better experience, try to keep the upgrade experience smooth.
   :::

:::info Important Considerations
For better experience, try to keep the upgrade experience smooth.
:::

Expected behavior

Both admonitions should be rendered as admonitions.

Actual behavior

  1. The admonition inside the list is not treated as markup element and rendered as a raw text instead of an admonition element
  2. The admonition outside of the list is rendered correctly

Your environment

  • Docusaurus version used: 3.0.0
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome 119, Node.js v18.16.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows 11

Self-service

  • I'd be willing to fix this bug myself.
@hrumhurum hrumhurum added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 5, 2023
@Josh-Cena Josh-Cena added domain: markdown Related to Markdown parsing or syntax and removed status: needs triage This issue has not been triaged by maintainers labels Nov 6, 2023
@AnthonyTsu1984
Copy link

Same issue here.

The following indented admonition can be displayed correctly.

1. In the **Create New Cluster** section, choose the **Starter** plan and fill in the required parameters. 
    :::info Notes    
    
    Each user is permitted one free serverless cluster. For additional clusters, opt for the Standard or Enterprise plans.

    :::

image

The following blocks do not

- **Scale-up cluster**
    :::caution Warning    
    
    Scaling up a cluster may cause several minutes of downtime. Please exercise caution.

    :::

image

@slorber
Copy link
Collaborator

slorber commented Nov 11, 2023

Hey

Admonitions in Docusaurus v3 are now using the Markdown directive syntax, and the way to specify a title is different now.

https://docusaurus.io/docs/markdown-features/admonitions#specifying-title

CleanShot 2023-11-11 at 18 34 58@2x

In the v3 migration guide, it is explained that we provide retrocompatibility with v2 syntax thanks to a compatibility option

https://docusaurus.io/docs/migration/v3#admonitions-option

CleanShot 2023-11-11 at 18 36 30@2x

So, we can consider it a bug in our v2 compatibility layer: apparently we don't process admonitions properly when they are nested and line starts with space/indentation.


Note: this only happens with admonitions using the v2 title syntax (that we'll deprecate), because MDX is able to parse admonitions without titles and admonitions with markdown directive title syntax, cf playground:

CleanShot 2023-11-11 at 18 38 58@2x

So, we can fix it, but I'd recommend to fix it yourself by using the markdown directive label syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution domain: markdown Related to Markdown parsing or syntax
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants