1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00
joplin/packages/renderer/MdToHtml/rules/utils/defaultRule.ts

10 lines
419 B
TypeScript
Raw Normal View History

import type * as MarkdownIt from 'markdown-it';
import type * as Renderer from 'markdown-it/lib/renderer';
const defaultRule = (markdownIt: MarkdownIt, key: keyof Renderer.RenderRuleRecord): Renderer.RenderRule => {
if (markdownIt.renderer.rules[key]) return markdownIt.renderer.rules[key];
return (tokens, idx, options, _env, renderer) => renderer.renderToken(tokens, idx, options);
};
export default defaultRule;