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

Show Plain Text in Preview for Unrecognized Languages (#698) #718

Merged
merged 2 commits into from
Dec 14, 2020

Conversation

guneskaan
Copy link
Contributor

Fixed #698.

Currently, we display invisible text when the language specified for the code block is not recognized.
This is because in MarkdownPreviewer.tsx: rehypeCodeMirrorAttacher(), there is an edge case where if language is not null but there is no mime found for this language that can be found in CodeMirror.findModeByName, we set node.children to [].

Fix this case by returning early before the node.children = cmResult assignment.

Tested with following languages after applying the change above:
java -> rendered with java highlighting
123f (made up language) -> rendered as plain text
(empty) -> rendered as plain text

@Flexo013 Flexo013 added the awaiting review ❇️ Pull request is awaiting a review. label Dec 13, 2020
@Rokt33r
Copy link
Member

Rokt33r commented Dec 14, 2020

Looks perfect! Thank you so much!

@Rokt33r Rokt33r added this to the v0.12.0 milestone Dec 14, 2020
@Rokt33r Rokt33r merged commit 4dd6ab1 into BoostIO:master Dec 14, 2020
@guneskaan guneskaan deleted the blank-code-block-unknown-languages branch December 14, 2020 22:56
@Rokt33r Rokt33r removed the awaiting review ❇️ Pull request is awaiting a review. label Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code block is blank with unknown languages
3 participants