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

[docs] Tables which has a pipe in a code are broken #10499

Closed
Nkzn opened this issue Oct 1, 2020 · 5 comments · Fixed by #10550
Closed

[docs] Tables which has a pipe in a code are broken #10499

Nkzn opened this issue Oct 1, 2020 · 5 comments · Fixed by #10550
Assignees
Labels

Comments

@Nkzn
Copy link
Contributor

Nkzn commented Oct 1, 2020

SSIA. The | in the code (`) is recognized as a table separator.

code:

| Name                                    | Type                              | Description                                                                                                                                                         |
| --------------------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [iosClientId][g-creds]                  | `string | undefined`              | The iOS client id registered with Google for use in the Expo client app.                                                                                            |

capture:

スクリーンショット 2020-10-02 0 16 16

page: https://docs.expo.io/versions/v39.0.0/sdk/google/

This was caused by #10177 . MDX v1 is GFM compliant, and GFM has same problem.

Name Type Description
[iosClientId][g-creds] `string undefined`

this can be solved with escaping the pipe in GFM.

| Name                                    | Type                              | Description                                                                                                                                                         |
| --------------------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [iosClientId][g-creds]                  | `string \| undefined`              | The iOS client id registered with Google for use in the Expo client app.                                                                                            |
Name Type Description
[iosClientId][g-creds] string | undefined The iOS client id registered with Google for use in the Expo client app.

but, in the MDX v1.6.18, \ is remaining.

スクリーンショット 2020-10-02 0 31 08

This is MDX's issue. mdx-js/mdx#1285

workaround

revert #10177 😢

@ide
Copy link
Member

ide commented Oct 1, 2020

We've merged a partial fix (#10500) but it looks like a bug with MDX still causes botched rendering, it's just less botched now (you can figure out what to do, it just looks broken).

@barthap
Copy link
Contributor

barthap commented Oct 2, 2020

@byCedric
Copy link
Member

byCedric commented Oct 5, 2020

To fix this issue fully, we probably have to wait until remarkjs/remark#536 is merged and released. It's an issue within remark's internals. Until then, we can do two things:

  1. "Cheat" our way around the pipe character (|), by using a similar character like the divisor ().

  2. Wrap code blocks with <InlineCode>string \| null</InlineCode> to allow character escaping (works around the remark parser).

In the example below, the first line has the divisor character and second line has <InlineCode> wrapped and escaped |.
Screenshot 2020-10-05 at 15 55 46

In code, it looks like:

| `ios.icon ∣ icon`                            | ...
| <InlineCode>web.favicon \| icon</InlineCode> | ...

@ide Which one do you prefer? I think 1 is the simplest solution, but also might be too confusing for people to contribute with. 2 is very expressive and increases the code (decreases readability from markdown). Either way, this would solve our current issue until the fix is released.


Edit: talked with Cruzan, option 2 seems like the most sensible one in this case.

@ide
Copy link
Member

ide commented Oct 5, 2020

I agree the second option is better. The issue is non-obvious and needs to be communicated instead of hidden behind a different unicode character since this is text that people type. The divisor character would make sense to me if it were autogenerated on each build and never typed by people, but otherwise no one is going to know they need to type it. Also it presumably breaks copy/pasting from the docs.

@wooorm
Copy link

wooorm commented Oct 7, 2020

It’s not remark internals. It’s MDX internals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants