aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java7
1 files changed, 6 insertions, 1 deletions
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 b71d3d0f..b460a240 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
@@ -41,7 +41,12 @@ public class Utils {
.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("(?<![\\[\\(])#(?![# ])(?![\\w\\s]*[\\]\\)])", "# "));
+ .replaceAll("^#(?!($|\\s))", "# ")
+ .replaceAll("^##(?!($|\\s))", "## ")
+ .replaceAll("^###(?!($|\\s))", "### ")
+ .replaceAll("^####(?!($|\\s))", "#### ")
+ .replaceAll("^#####(?!($|\\s))", "##### ")
+ .replaceAll("^######(?!($|\\s))", "###### "));
//Fix superscript
int startIndex = regexed.indexOf("^");