Fix empty code input in syntax-highlight
This commit is contained in:
parent
33701a179f
commit
f7f8f6d1ee
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
# 4.2.2-SNAPSHOT
|
# 4.2.2-SNAPSHOT
|
||||||
* Fixed `AsyncDrawable` display when it has placeholder with empty bounds ([#189])
|
* 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
|
[#189]: https://github.com/noties/Markwon/issues/189
|
||||||
|
[#192]: https://github.com/noties/Markwon/issues/192
|
||||||
|
|
||||||
# 4.2.1
|
# 4.2.1
|
||||||
* Fix SpannableBuilder `subSequence` method
|
* Fix SpannableBuilder `subSequence` method
|
||||||
|
@ -41,6 +41,13 @@ public class Prism4jSyntaxHighlight implements SyntaxHighlight {
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public CharSequence highlight(@Nullable String info, @NonNull String code) {
|
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
|
// if info is null, do not highlight -> LICENCE footer very commonly wrapped inside code
|
||||||
// block without syntax name specified (so, do not highlight)
|
// block without syntax name specified (so, do not highlight)
|
||||||
return info == null
|
return info == null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user