-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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][material-ui] Format key
prop JSDoc description in Snackbar
component code correctly
#38603
[docs][material-ui] Format key
prop JSDoc description in Snackbar
component code correctly
#38603
Conversation
…ption. Inline code examples in JSDoc descriptions should be contained within markdown backticks. This ensures they render correctly as code in editor IntelliSense as well as in the generated Material UI API docs page. This is especially important if the code example looks like a JSX or HTML tag, otherwise markdown renderers will attempt to render it as HTML. If the renderer only accepts a subset of HTML tags (such as VS Code IntelliSense) then it will strip the code example out of the rendered HTML. In other situations where React is used to render the markdown without an allowlist for JSX/HTML (e.g. the Storybook docs page props table), then not wrapping JSX code examples in backticks in the source JSDoc description markdown can cause a React render error.
Netlify deploy previewhttps://deploy-preview-38603--material-ui.netlify.app/ Bundle size report |
Snackbar
prop key
JSDoc descriptionSnackbar
prop key
JSDoc description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just phrased a bit better.
Snackbar
prop key
JSDoc descriptionkey
prop JSDoc description in Snackbar
component code correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaydenseric Thanks for your first contribution at MUI! Looking forward for more!
This PR correctly formats inline code in the component
Snackbar
propkey
JSDoc description. I also improved the sentences and grammar, and formatted the JSDoc comment to 80 char line lengths.Inline code examples in JSDoc descriptions should be contained within markdown backticks. This ensures they render correctly as code in editor IntelliSense as well as in the generated Material UI API docs page. This is especially important if the code example looks like a JSX or HTML tag, otherwise markdown renderers will attempt to render it as HTML. If the renderer only accepts a subset of HTML tags (such as VS Code IntelliSense) then it will strip the code example out of the rendered HTML. In other situations where React is used to render the markdown without an allowlist for JSX/HTML (e.g. the Storybook docs page props table), then not wrapping JSX code examples in backticks in the source JSDoc description markdown can cause a React render error.
Here is the VS Code IntelliSense for the component
Snackbar
propkey
before this PR:Note the inline code examples have been stripped out by the markdown renderer.
Here is after this PR:
Note the inline code examples render correctly.
Here is Storybook docs page prop table rendering before this PR:
Note the React rendering error causing the code examples not to display:
After this PR:
Note there is no longer React rendering errors, and the code examples display correctly in the HMTL.
Here is the Material UI API docs for the component
Snackbar
propkey
before this PR:https://mui.com/material-ui/api/snackbar/#Snackbar-prop-key
Note the inline code is rendering as text, instead of code. This should be fixed after this PR.