-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
fix: warn unsupported languages by prismjs #1107
fix: warn unsupported languages by prismjs #1107
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Deploy preview for docusaurus-preview ready! Built with commit 538b8ee |
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.
LGTM. Small nits
v1/lib/core/renderMarkdown.js
Outdated
console.error(err); | ||
if (err.code === 'MODULE_NOT_FOUND') { | ||
const unsupportedLanguageError = chalk.yellow( | ||
`Warning: language-${language} is not supported by prismjs.` + |
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.
Let's omit the language-
so that it will be something like
`Warning: ${language} is not supported by prismjs.`
Even better if we put different color for the language itself
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.
@endiliey Okay, Ive made that change.
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thanks ! @Shriram-Balaji |
Motivation
Fixes #1076
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
The stacktrace errors thrown by prismjs for unsupported languages (eg:
toml
) are now logged only as a warning message instead of logging the entire stack trace. This can be tested by doing the following changes:Set
usePrism:true
insiteConfig.js
.Modify docs/api-doc-markdown.md to render a language not supported by prismjs.
Eg: (toml)
cd website yarn start
A warning message similar to the screenshot below would be logged in the console.