diff --git a/client/html/help_comments.tpl b/client/html/help_comments.tpl
index 6ba7e9f8..bd3a6bea 100644
--- a/client/html/help_comments.tpl
+++ b/client/html/help_comments.tpl
@@ -26,6 +26,10 @@
[sjis](´・ω・`)[/sjis] |
adds SJIS art |
+
+ [icon]https://youtube.com[/icon] |
+ adds the site icon next to the link |
+
diff --git a/client/js/util/markdown.js b/client/js/util/markdown.js
index e71e3263..da7f678b 100644
--- a/client/js/util/markdown.js
+++ b/client/js/util/markdown.js
@@ -110,6 +110,15 @@ class StrikeThroughWrapper extends BaseMarkdownWrapper {
}
}
+class FaviconWrapper extends BaseMarkdownWrapper {
+ preprocess(text) {
+ return text.replace(
+ /\[icon\]((?:[^\[]|\[(?!\/?icon\]))+)\[\/icon\]/gi,
+ "[]($1) $1"
+ );
+ }
+}
+
function createRenderer() {
function sanitize(str) {
return str.replace(/&<"/g, (m) => {
@@ -155,6 +164,7 @@ function formatMarkdown(text) {
new SpoilersWrapper(),
new SmallWrapper(),
new StrikeThroughWrapper(),
+ new FaviconWrapper(),
];
for (let wrapper of wrappers) {
text = wrapper.preprocess(text);
@@ -181,6 +191,7 @@ function formatInlineMarkdown(text) {
new SpoilersWrapper(),
new SmallWrapper(),
new StrikeThroughWrapper(),
+ new FaviconWrapper(),
];
for (let wrapper of wrappers) {
text = wrapper.preprocess(text);