Skip to content

Commit

Permalink
Update MarkupUtil.java
Browse files Browse the repository at this point in the history
  • Loading branch information
xdnw committed Aug 5, 2024
1 parent 3b596ee commit a02ddd5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/link/locutus/discord/util/MarkupUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,10 @@ public NodeRenderer apply(DataHolder options) {
}

public static String markdownToHTML(String source) {
source = source.replaceAll("``` ", "\n```\n");
source = source.replaceAll("```(?:csv|json|ansi|md|diff)?", "\n```$0\n");
source = source.replaceAll("\n\n```", "\n```");
source = source.replaceAll("(```(?:csv|json|ansi|md|diff)?)\n\n", "$1\n");

Node document = MARKDOWN_PARSER.parse(source);
String html = MARKDOWN_RENDERER.render(document).trim();
if (html.startsWith("<p>") && html.endsWith("</p>")) {
Expand Down

0 comments on commit a02ddd5

Please sign in to comment.