Files
outline/shared/editor/rules/emoji.ts
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00

23 lines
713 B
TypeScript

import type MarkdownIt from "markdown-it";
import { full as emojiPlugin } from "markdown-it-emoji";
import { nameToEmoji } from "../lib/emoji";
type Options = MarkdownIt.Options & {
emoji: boolean;
};
export default function emoji(md: MarkdownIt) {
// Ideally this would be an empty object, but due to a bug in markdown-it-emoji
// passing an empty object results in newlines becoming emojis. Until this is
// fixed at least one key is required. See:
// https://github.com/markdown-it/markdown-it-emoji/issues/46
const noMapping = {
no_name_mapping: "💯",
};
return emojiPlugin(md, {
defs: (md.options as Options).emoji === false ? noMapping : nameToEmoji,
shortcuts: {},
});
}