@fedify/markdown-it-hashtag
Version:
A markdown-it plugin that parses and renders Mastodon-style #hashtags.
14 lines (13 loc) • 454 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.spanHashAndTag = spanHashAndTag;
const mod_js_1 = require("../deps/jsr.io/@std/html/0.224.2/mod.js");
/**
* Renders a hashtag into an HTML string.
*/
function spanHashAndTag(hashtag) {
if (hashtag.startsWith("#")) {
hashtag = hashtag.substring(1);
}
return `<span class="hash">#</span><span class="tag">${(0, mod_js_1.escape)(hashtag)}</span>`;
}