mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-27 19:09:12 +00:00
Cleanup, only check for /u/ if /c/ and /m/ checks fail
This commit is contained in:
parent
7bd90da1f8
commit
d58fd63113
|
@ -101,7 +101,6 @@ function localInstanceLinkParser(md: MarkdownIt) {
|
||||||
newTokens.push(textToken);
|
newTokens.push(textToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the new href
|
|
||||||
let href;
|
let href;
|
||||||
if (match[0].startsWith("!")) {
|
if (match[0].startsWith("!")) {
|
||||||
href = "/c/" + match[0].substring(1);
|
href = "/c/" + match[0].substring(1);
|
||||||
|
@ -109,10 +108,9 @@ function localInstanceLinkParser(md: MarkdownIt) {
|
||||||
href = "/c/" + match[0].substring(3);
|
href = "/c/" + match[0].substring(3);
|
||||||
} else {
|
} else {
|
||||||
href = match[0];
|
href = match[0];
|
||||||
}
|
if (match[0].startsWith("/u/")) {
|
||||||
|
linkClass = "user-link";
|
||||||
if (match[0].startsWith("/u/")) {
|
}
|
||||||
linkClass = "user-link";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const linkOpenToken = new state.Token("link_open", "a", 1);
|
const linkOpenToken = new state.Token("link_open", "a", 1);
|
||||||
|
@ -137,7 +135,6 @@ function localInstanceLinkParser(md: MarkdownIt) {
|
||||||
newTokens.push(textToken);
|
newTokens.push(textToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the original token with the new tokens
|
|
||||||
inlineTokens.splice(j, 1, ...newTokens);
|
inlineTokens.splice(j, 1, ...newTokens);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +159,7 @@ export function setupMarkdown() {
|
||||||
.use(markdown_it_footnote)
|
.use(markdown_it_footnote)
|
||||||
.use(markdown_it_html5_embed, html5EmbedConfig)
|
.use(markdown_it_html5_embed, html5EmbedConfig)
|
||||||
.use(markdown_it_container, "spoiler", spoilerConfig)
|
.use(markdown_it_container, "spoiler", spoilerConfig)
|
||||||
.use(localCommunityLinkParser);
|
.use(localInstanceLinkParser);
|
||||||
// .use(markdown_it_emoji, {
|
// .use(markdown_it_emoji, {
|
||||||
// defs: emojiDefs,
|
// defs: emojiDefs,
|
||||||
// });
|
// });
|
||||||
|
@ -173,7 +170,7 @@ export function setupMarkdown() {
|
||||||
.use(markdown_it_footnote)
|
.use(markdown_it_footnote)
|
||||||
.use(markdown_it_html5_embed, html5EmbedConfig)
|
.use(markdown_it_html5_embed, html5EmbedConfig)
|
||||||
.use(markdown_it_container, "spoiler", spoilerConfig)
|
.use(markdown_it_container, "spoiler", spoilerConfig)
|
||||||
.use(localCommunityLinkParser)
|
.use(localInstanceLinkParser)
|
||||||
// .use(markdown_it_emoji, {
|
// .use(markdown_it_emoji, {
|
||||||
// defs: emojiDefs,
|
// defs: emojiDefs,
|
||||||
// })
|
// })
|
||||||
|
|
Loading…
Reference in a new issue