Skip to content

Commit

Permalink
Fix empty code input in syntax-highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
noties committed Feb 14, 2020
1 parent 33701a1 commit f7f8f6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

# 4.2.2-SNAPSHOT
* Fixed `AsyncDrawable` display when it has placeholder with empty bounds ([#189])
* Fixed `syntax-highlight` where code input is empty string ([#192])

[#189]: https://github.com/noties/Markwon/issues/189
[#192]: https://github.com/noties/Markwon/issues/192

# 4.2.1
* Fix SpannableBuilder `subSequence` method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ protected Prism4jSyntaxHighlight(
@NonNull
@Override
public CharSequence highlight(@Nullable String info, @NonNull String code) {

// @since 4.2.2-SNAPSHOT
// although not null, but still is empty
if (code.isEmpty()) {
return code;
}

// if info is null, do not highlight -> LICENCE footer very commonly wrapped inside code
// block without syntax name specified (so, do not highlight)
return info == null
Expand Down

0 comments on commit f7f8f6d

Please sign in to comment.