@fedify/markdown-it-hashtag, a markdown-it plugin that parses and renders Mastodon-style #hashtags, just released 0.3.0! In this release, link, linkAttributes, and label callbacks became to take one more parameter, a markdown-it environment, which enables your hashtag rendering more flexible. For example, now hashtag links can be dynamically determined:
import MarkdownIt from "markdown-it";
import { hashtag } from "@fedify/markdown-it-hashtag";
const md = new MarkdownIt();
md.use(hashtag, {
link: (tag: string, env: any) => `${env.origin}/tags/${tag.substring(1)}`
});
const html = md.render("Your Markdown text with #hashtags!", {
origin: "https://example.com"
});
@fedify/markdown-it-hashtag 0.3.0 is available at both JSR and npm!
npmjs.com
@fedify/markdown-it-hashtag
A markdown-it plugin that parses and renders Mastodon-style #hashtags.. Latest version: 0.3.0, last published: 6 minutes ago. Start using @fedify/markdown-it-hashtag in your project by running `npm i @fedify/markdown-it-hashtag`. There are no other projects in the npm registry using @fedify/markdown-it-hashtag.