mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
client/markdown: add tag to show favicon alongside URL
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user