client/misc: fix Markdown permalinks
This commit is contained in:
parent
a28b4bdd3e
commit
4295e1c827
1 changed files with 4 additions and 4 deletions
|
@ -111,9 +111,9 @@ function formatMarkdown(text) {
|
||||||
text = text.replace(
|
text = text.replace(
|
||||||
/(^|^\(|(?:[^\]])\(|[\s<>\[\]\)])([+#@][a-zA-Z0-9_-]+)/g,
|
/(^|^\(|(?:[^\]])\(|[\s<>\[\]\)])([+#@][a-zA-Z0-9_-]+)/g,
|
||||||
'$1[$2]($2)');
|
'$1[$2]($2)');
|
||||||
text = text.replace(/\]\(@(\d+)\)/g, '](#/post/$1)');
|
text = text.replace(/\]\(@(\d+)\)/g, '](/post/$1)');
|
||||||
text = text.replace(/\]\(\+([a-zA-Z0-9_-]+)\)/g, '](#/user/$1)');
|
text = text.replace(/\]\(\+([a-zA-Z0-9_-]+)\)/g, '](/user/$1)');
|
||||||
text = text.replace(/\]\(#([a-zA-Z0-9_-]+)\)/g, '](#/posts/query=$1)');
|
text = text.replace(/\]\(#([a-zA-Z0-9_-]+)\)/g, '](/posts/text=$1)');
|
||||||
return text;
|
return text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ function formatMarkdown(text) {
|
||||||
//search permalinks
|
//search permalinks
|
||||||
text = text.replace(
|
text = text.replace(
|
||||||
/\[search\]((?:[^\[]|\[(?!\/?search\]))+)\[\/search\]/ig,
|
/\[search\]((?:[^\[]|\[(?!\/?search\]))+)\[\/search\]/ig,
|
||||||
'<a href="#/posts/query=$1"><code>$1</code></a>');
|
'<a href="/posts/text=$1"><code>$1</code></a>');
|
||||||
//spoilers
|
//spoilers
|
||||||
text = text.replace(
|
text = text.replace(
|
||||||
/\[spoiler\]((?:[^\[]|\[(?!\/?spoiler\]))+)\[\/spoiler\]/ig,
|
/\[spoiler\]((?:[^\[]|\[(?!\/?spoiler\]))+)\[\/spoiler\]/ig,
|
||||||
|
|
Loading…
Reference in a new issue