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

<strong> Tag Doesn't Shows Properly in <pre> Block #6156

Closed
6 of 7 tasks
DawnMagnet opened this issue Dec 22, 2021 · 6 comments · Fixed by #6177
Closed
6 of 7 tasks

<strong> Tag Doesn't Shows Properly in <pre> Block #6156

DawnMagnet opened this issue Dec 22, 2021 · 6 comments · Fixed by #6177
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@DawnMagnet
Copy link

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

I Write a Test Case below

输入:a = "abcd", b = "cdabcdab"
输出:3
解释:a 重复叠加三遍后为 "abcdabcdabcd", 此时 b 是其子串。
<pre>
  <strong>输入:</strong>a = "abcd", b = "cdabcdab"
  <strong>输出:</strong>3
  <strong>解释:</strong>a 重复叠加三遍后为 "ab<strong>cdabcdab</strong>cd", 此时 b 是其子串。
</pre>

As we can see blow, Github shows correctly
but if this block appears in a docusaurus MarkDown file when build a website
it appears like blow
image

[object Object]a = "abcd", b = "cdabcdab"[object Object]3[object Object]a 重复叠加三遍后为 "ab[object Object]cd", 此时 b 是其子串。

which turns <strong> tag into [object Object]

Steps to reproduce

write a markdown file includes <strong> tag in a <pre> tag

<pre>
  <strong>输入:</strong>a = "abcd", b = "cdabcdab"
  <strong>输出:</strong>3
  <strong>解释:</strong>a 重复叠加三遍后为 "ab<strong>cdabcdab</strong>cd", 此时 b 是其子串。
</pre>

Expected behavior

Correct Content

Actual behavior

Incorrent

Your environment

Reproducible demo

No response

Self-service

  • I'd be willing to fix this bug myself.
@DawnMagnet DawnMagnet 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 Dec 22, 2021
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Dec 22, 2021

Looks like a Docusaurus error, can't reproduce in MDX playground. It's probably because we map pre elements to Code blocks. However, @DawnMagnet do take note that Docusaurus doesn't guarantee compatibility with GFM because we are, after all, using MDX. The line breaks aren't preserved even when using pre and you would probably have to use {'\n'} to preserve that

@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Dec 22, 2021
@DawnMagnet
Copy link
Author

DawnMagnet commented Dec 22, 2021

Looks like a Docusaurus error, can't reproduce in MDX playground. It's probably because we map pre elements to Code blocks. However, @DawnMagnet do take note that Docusaurus doesn't guarantee compatibility with GFM because we are, after all, using MDX. The line breaks aren't preserved even when using pre and you would probably have to use {'\n'} to preserve that

Thanks, I think MDX should have compatibility with native html, just use GFM to reproduce, as for the line breaks, I will use <br/> instead

@Josh-Cena
Copy link
Collaborator

Thanks, I think MDX should have compatibility with native html

That would be impossible, because MDX is more biased to the JSX side than to the MD side. You should see it as JSX with MD interspersed rather than Markdown that happens to be rendered as JSX.

GFW

I hope you mean GFM 😝

@DawnMagnet
Copy link
Author

DawnMagnet commented Dec 22, 2021

That would be impossible, because MDX is more biased to the JSX side than to the MD side. You should see it as JSX with MD interspersed rather than Markdown that happens to be rendered as JSX.

Perhaps I should close this issue and figure out a new way to bold sth. in the code blocks?

@Josh-Cena
Copy link
Collaborator

No, it's still a valid issue because the [object Object] thing is still wrong

@Josh-Cena
Copy link
Collaborator

Fixed by #6177. Please test with the latest canary release.

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
Development

Successfully merging a pull request may close this issue.

2 participants