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

[v2] content parsing issue inside the markdown table #3758

Closed
Simek opened this issue Nov 16, 2020 · 2 comments
Closed

[v2] content parsing issue inside the markdown table #3758

Simek opened this issue Nov 16, 2020 · 2 comments
Labels
external This issue is caused by an external dependency and not Docusaurus.

Comments

@Simek
Copy link
Contributor

Simek commented Nov 16, 2020

🐛 Bug Report

It looks like on the React Native website we currently experiencing MDX parsing issue inside the markdown table:

One of color hashes is not rendered in code block besides that the both entries are using the same code:

Issue preview

Screenshot 2020-11-16 153358

Have you read the Contributing Guidelines on issues?

Yes.

To Reproduce

(Write your steps here:)

  1. Visit https://reactnative.dev/docs/next/button#color
  2. Check out the #2196F3 formatting in the table

Or

  1. Follow https://github.com/facebook/react-native-website#%EF%B8%8F-getting-started
  2. Go to http://localhost:3000/docs/next/button#color
  3. Check out the #2196F3 formatting in the table

Expected behavior

#2196F3 string should be formatted as code block.

Actual Behavior

#2196F3 is not correctly formatted.

Your Environment

  • Docusaurus version used: 2.0.0-alpha.66
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Not browser dependent, Node LTS and Latest

Reproducible Demo

@Simek Simek 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 16, 2020
@slorber
Copy link
Collaborator

slorber commented Nov 16, 2020

It looks like MDX is not able to parse it correctly, even using the playground https://mdxjs.com/playground/, so it seems it's not our fault

### `color`

Color of the text (iOS), or background color of the button (Android).

| Type            | Default                                                                                                                                                                                                                                   |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [color](colors) | <ins style={{background: '#2196F3'}} className="color-box" /> `'#2196F3'` <div className="label android">Android</div><hr/><ins style={{background: '#007AFF'}} className="color-box" /> `'#007AFF'` <div className="label ios">iOS</div> |

becomes

<tbody parentName="table">
  <tr parentName="tbody">
    <td
      parentName="tr"
      {...{
        align: null
      }}
    >
      <a
        parentName="td"
        {...{
          href: "colors"
        }}
      >{`color`}</a>
    </td>
    <td
      parentName="tr"
      {...{
        align: null
      }}
    >
      <ins
        style={{
          background: "#2196F3"
        }}
        className="color-box"
      />{" "}
      `'#2196F3'` <div className="label android">Android</div>
      <hr />
      <ins
        style={{
          background: "#007AFF"
        }}
        className="color-box"
      />
      {` `}
      <inlineCode parentName="td">{`'#007AFF'`}</inlineCode>
      {` `}
      <div className="label ios">{`iOS`}</div>
    </td>
  </tr>
</tbody>

For those usecases it may be better to avoid interleaved of MD inside of JSX in table contents. Maybe you can just replace those cases by <inlineCode>#hex</inlineCode> directly?

@Josh-Cena
Copy link
Collaborator

Closing in favor of #4029. MDX 2.0 allows interleaving JSX with Markdown.

@Josh-Cena Josh-Cena added external This issue is caused by an external dependency and not Docusaurus. and removed 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 Mar 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external This issue is caused by an external dependency and not Docusaurus.
Projects
None yet
Development

No branches or pull requests

3 participants