这是indexloc提供的服务,不要输入任何密码
Skip to content

Commit 8ee0c5a

Browse files
Fixed: Fix markdown link generation
The `]` characters in label and `)` characters in url must be escaped.
1 parent 501d13a commit 8ee0c5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

termux-shared/src/main/java/com/termux/shared/markdown/MarkdownUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ public static String getMultiLineMarkdownStringEntry(String label, Object object
119119
return "**" + label + "**: " + def + "\n";
120120
}
121121

122-
public static String getLinkMarkdownString(String label, Object object) {
123-
if (object != null)
124-
return "[" + label + "](" + object + ")";
122+
public static String getLinkMarkdownString(String label, String url) {
123+
if (url != null)
124+
return "[" + label.replaceAll("]", "\\\\]") + "](" + url.replaceAll("\\)", "\\\\)") + ")";
125125
else
126126
return label;
127127
}

0 commit comments

Comments
 (0)