diff --git a/src/page.mjs b/src/page.mjs index 9312473..2155b4d 100644 --- a/src/page.mjs +++ b/src/page.mjs @@ -15,7 +15,6 @@ const marked = new Marked({ }, tokenizer(src, tokens) { const match = src.match(/^\[\[([^|\]]+)(?:\|([^\]]+))?]]/) - console.debug("Is this a wikilink?", src, tokens, match) if(match) { return { type: "wikilink", @@ -28,6 +27,26 @@ const marked = new Marked({ renderer(token) { return `${token.display ?? token.target}` }, + }, + { + name: "hashtag", + level: "inline", + start(src) { + return src.match(/^#/)?.index + }, + tokenizer(src, tokens) { + const match = src.match(/^#([A-Za-z0-9]+)/) + if(match) { + return { + type: "hashtag", + raw: match[0], + tag: match[1], + } + } + }, + renderer(token) { + return `#${token.tag}` + } } ] })