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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admonitions in partials outside the docs directory are rendered as plain text #5333

Closed
leograba opened this issue Aug 10, 2021 · 5 comments 路 Fixed by #5339
Closed

Admonitions in partials outside the docs directory are rendered as plain text #5333

leograba opened this issue Aug 10, 2021 · 5 comments 路 Fixed by #5339
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@leograba
Copy link

leograba commented Aug 10, 2021

馃悰 Bug Report

Prerequisites

  • [x ] I'm using the latest version of Docusaurus. I'm using the canary release 0.0.0-3914 because it support adding partials from outside the docs plugin directory.

Description

When including a partial from a file outside the doc plugin directory, if the partial contains admonitions then the admonitions are rendered as plain text.

Have you read the Contributing Guidelines on issues?

Yes.

Steps to reproduce

  1. Create a new project from the template with npx @docusaurus/init@latest init my-website classic
    1. Update Docusaurus version to a canary release that supports including partials from outside the docs plugin directory, currently 2.0.0-beta.4 does not support it. I've used 0.0.0-3914.
  2. Create a new file /docs/test-doc.mdx and a directory and partial file /_shared/test-partial.mdx:
    1. /docs/test-doc.mdx
      ---
      id: test-doc
      ---
      import TabItem from '@theme/TabItem';
      import Tabs from '@theme/Tabs'
      import Partial from '@site/_shared/test-partial.mdx';
      
      # Test Doc #
      
      Some paragraph.
      
      :::info
      
      This is an info panel outside a partial.
      
      :::
      
      <Partial />
      
    2. /_shared/test-partial.mdx
      import Tabs from '@theme/Tabs';
      import TabItem from '@theme/TabItem';
      
      :::info
      
      This is an info panel inside a partial.
      
      :::
      
      <Tabs
      defaultValue="apple"
      values={[
          {label: 'Apple', value: 'apple'},
          {label: 'Orange', value: 'orange'},
          {label: 'Banana', value: 'banana'},
      ]}>
      <TabItem value="apple">This is an apple 馃崕</TabItem>
      <TabItem value="orange">This is an orange 馃崐</TabItem>
      <TabItem value="banana">This is a banana 馃崒</TabItem>
      </Tabs>
      
      ```bash title="source.sh"
      # Source is ok
      $ ls -l .
      \```
      
  3. Run npx docusaurus start and navigate to http://localhost:3000/docs/test-doc.

Expected behavior

The admonition from the partial file /_shared/test-partial.mdx (This is an info panel inside a partial.) should be rendered with admonition style instead of plain text.

Actual behavior

image

There are no errors on npx docusaurus start.

Your environment

Reproducible demo

https://codesandbox.io/s/youthful-architecture-w2xcy?file=/docs/test-doc.mdx

Visit the page https://w2xcy.sse.codesandbox.io/docs/test-doc to see the issue live.

@leograba leograba 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 Aug 10, 2021
@pranabdas
Copy link
Contributor

@leograba I see you have space between ::: and info in /docs/_test-partial.mdx. I guess it should not be there.

@slorber
Copy link
Collaborator

slorber commented Aug 11, 2021

agree, the issue is the extra space

@slorber slorber closed this as completed Aug 11, 2021
@leograba leograba changed the title Admonitions in partials are rendered as plain text Admonitions in partials outside the docs directory are rendered as plain text Aug 11, 2021
@leograba
Copy link
Author

Sorry, indeed I made a syntax issue mistake while creating the initial sandbox environment.

Nevertheless, after fixing the syntax issue and creating a proper setup where the partial is a file outside /docs, I could reproduce the potential bug.

@slorber
Copy link
Collaborator

slorber commented Aug 11, 2021

Right, can reproduce the issue 馃憤 will get this fixed

@slorber
Copy link
Collaborator

slorber commented Aug 11, 2021

fixed in #5339

@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Feb 22, 2022
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
Projects
None yet
4 participants