Skip to content

Commit

Permalink
Add missing safety
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Sep 6, 2024
1 parent f26c101 commit 060c091
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public static String escapeHtml(String html) {
* Again very naive but should catch most issues.
*/
public static String escapeMarkdown(String markdown) {
if (markdown == null || markdown.isBlank()) {
return markdown;
}

return markdown.replace("#", "\\#")
.replace("*", "\\*")
.replace("`", "\\`");
Expand Down

0 comments on commit 060c091

Please sign in to comment.