From 05b8b73043cffed8dabe955c240f4c1ad5f1b51f Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 8 Jan 2021 13:36:30 +0800 Subject: Correctly shows Snudown's header. --- .../main/java/ml/docilealligator/infinityforreddit/utils/Utils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java index 16fc6b0e..d3140863 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java @@ -40,8 +40,9 @@ public class Utils { StringBuilder regexed = new StringBuilder(markdown .replaceAll("((?<=[\\s])|^)/[rRuU]/[\\w-]+/{0,1}", "[$0](https://www.reddit.com$0)") .replaceAll("((?<=[\\s])|^)[rRuU]/[\\w-]+/{0,1}", "[$0](https://www.reddit.com/$0)") - .replaceAll("\\^{2,}", "^")); + .replaceAll("\\^{2,}", "^").replaceAll("#(?![# ])", "# ")); + //Fix superscript int startIndex = regexed.indexOf("^"); while (startIndex >= 0 && startIndex + 1 < regexed.length()) { char currentChar = regexed.charAt(startIndex + 1); -- cgit v1.2.3