Fix regex for supporting snudown's header.

This commit is contained in:
Alex Ning 2021-01-08 13:59:27 +08:00
parent 05b8b73043
commit 0887b53426

View File

@ -40,7 +40,8 @@ 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("#(?![# ])", "# "));
.replaceAll("\\^{2,}", "^")
.replaceAll("(?<![\\[\\(])#(?![# ])(?![\\w\\s]*[\\]\\)])", "# "));
//Fix superscript
int startIndex = regexed.indexOf("^");