71 lines
2.3 KiB
TypeScript
71 lines
2.3 KiB
TypeScript
import { PluginWithOptions } from 'markdown-it';
|
|
import { RuleBlock } from 'markdown-it/lib/parser_block.mjs';
|
|
import { RuleInline } from 'markdown-it/lib/parser_inline.mjs';
|
|
|
|
/**
|
|
* Options of @mdit-vue/plugin-component
|
|
*/
|
|
interface ComponentPluginOptions {
|
|
/**
|
|
* Extra tags to be treated as block tags.
|
|
*
|
|
* @default []
|
|
*/
|
|
blockTags?: string[];
|
|
/**
|
|
* Extra tags to be treated as inline tags.
|
|
*
|
|
* @default []
|
|
*/
|
|
inlineTags?: string[];
|
|
}
|
|
|
|
/**
|
|
* Allows better use of Vue components in Markdown
|
|
*/
|
|
declare const componentPlugin: PluginWithOptions<ComponentPluginOptions>;
|
|
|
|
declare const createHtmlBlockRule: (options: Required<ComponentPluginOptions>) => RuleBlock;
|
|
|
|
declare const htmlInlineRule: RuleInline;
|
|
|
|
declare const HTML_TAG_RE: RegExp;
|
|
declare const HTML_OPEN_CLOSE_TAG_RE: RegExp;
|
|
declare const HTML_SELF_CLOSING_TAG_RE: RegExp;
|
|
declare const HTML_OPEN_AND_CLOSE_TAG_IN_THE_SAME_LINE_RE: RegExp;
|
|
|
|
/**
|
|
* List of block tags
|
|
*
|
|
* @see https://spec.commonmark.org/0.30/#html-blocks
|
|
* @see https://github.com/markdown-it/markdown-it/blob/master/lib/common/html_blocks.mjs
|
|
*/
|
|
declare const TAGS_BLOCK: string[];
|
|
/**
|
|
* According to markdown spec, all non-block html tags are treated as "inline"
|
|
* tags (wrapped with <p></p>), including those "unknown" tags
|
|
*
|
|
* Therefore, markdown-it processes "inline" tags and "unknown" tags in the same
|
|
* way, and does not care if a tag is "inline" or "unknown"
|
|
*
|
|
* As we want to take those "unknown" tags as custom components, we should
|
|
* treat them as "block" tags
|
|
*
|
|
* So we have to distinguish between "inline" and "unknown" tags ourselves
|
|
*
|
|
* The inline tags list comes from MDN
|
|
*
|
|
* @see https://spec.commonmark.org/0.30/#raw-html
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
|
|
*/
|
|
declare const TAGS_INLINE: string[];
|
|
/**
|
|
* Tags of Vue built-in components
|
|
*
|
|
* @see https://vuejs.org/api/built-in-components.html
|
|
* @see https://vuejs.org/api/built-in-special-elements.html
|
|
*/
|
|
declare const TAGS_VUE_RESERVED: string[];
|
|
|
|
export { type ComponentPluginOptions, HTML_OPEN_AND_CLOSE_TAG_IN_THE_SAME_LINE_RE, HTML_OPEN_CLOSE_TAG_RE, HTML_SELF_CLOSING_TAG_RE, HTML_TAG_RE, TAGS_BLOCK, TAGS_INLINE, TAGS_VUE_RESERVED, componentPlugin, createHtmlBlockRule, htmlInlineRule };
|