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

Document some of the gotchas of MDX #142

Open
bourdakos1 opened this issue Jan 2, 2022 · 0 comments
Open

Document some of the gotchas of MDX #142

bourdakos1 opened this issue Jan 2, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@bourdakos1
Copy link
Member

bourdakos1 commented Jan 2, 2022

The markdown in OpenAPI definition descriptions is processed by MDX. The results are similar to what would be generated by commonmark, but there are some noticeable differences/gotchas.

What I've come across so far:

  • Style attributes must follow the JSX syntax <div style={{ color: "red" }}> vs <div style="color: red;">
  • All tags must be closed. For example: Replace <your-name> with your name. will throw an error instead of rendering: Replace with your name..
  • Lists can contain html (similar to GitHub flavored markdown), so - Replace <your-name> with your name. will throw an error, because <your-name> will be treaded as html instead of a simple string

Valid commonmark:

List:
- one
- two
- <three>

<div style="background: red; height: 30px; width: 30px;">

Renders:
image

But the above is invalid MDX and would need to be rewritten as:

List:
- one
- two
- \<three\>

<div style={{ background: "red", height: "30px", width: "30px" }} />
@bourdakos1 bourdakos1 added the documentation Improvements or additions to documentation label Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant