Files
outline/shared/editor/rules/emoji.ts
Apoorv Mishra 1c7bb65c7a Document emoji picker (#4338)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
2023-09-03 06:11:14 -07:00

19 lines
632 B
TypeScript

import MarkdownIt from "markdown-it";
import emojiPlugin from "markdown-it-emoji";
import { nameToEmoji } from "../lib/emoji";
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 any).emoji === false ? noMapping : nameToEmoji,
shortcuts: {},
});
}