Fedify: an ActivityPub server framework's avatar
Fedify: an ActivityPub server framework

@[email protected]

@fedify/markdown-it-hashtag, a markdown-it plugin that parses and renders Mastodon-style , 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!