UNPKG

vue-markdown-wasm

Version:
204 lines (197 loc) 6.19 kB
import { ComponentOptionsMixin } from 'vue'; import { ComponentProvideOptions } from 'vue'; import { DefineComponent } from 'vue'; import { ExtractPropTypes } from 'vue'; import { ParseFlagsType } from '@logue/markdown-wasm'; import { PropType } from 'vue-demi'; import { PublicProps } from 'vue'; import { Ref } from 'vue-demi'; /** * Plugin installation function for Vue applications * @param app - Vue application instance */ export declare const install: (app: any) => void; export declare type MarkdownOutput = Uint8Array | string | null; export declare const Meta: MetaInterface; /** Build information meta data */ declare interface MetaInterface { /** Package name */ name: string; /** Version */ version: string; /** Author information */ author: { name: string; email: string; url: string; }; /** Build date */ date: string; } /** Vue Markdown Component */ declare const VueMarkdown: DefineComponent<ExtractPropTypes< { /** Model value */ modelValue: { type: PropType<string | Uint8Array>; default: string; }; /** * HTML tag to be used for the wrapper element. */ tag: { type: StringConstructor; default: string; }; /** Customize parsing behavior with flags */ parseFlags: { type: PropType<ParseFlagsType>; default: 1 | 2 | 4 | 256 | 512 | 2048; }; /** Select the output format (HTML or XHTML). */ format: { type: PropType<"html" | "xhtml">; default: string; }; /** * bytes=true causes parse() to return the result as a Uint8Array instead of a string. * * The returned Uint8Array is only valid until the next call to parse(). * If you need to keep the returned data around, call Uint8Array.slice() to make a copy, * as each call to parse() uses the same underlying memory. * * This only provides a performance benefit when you never need to convert the output * to a string. In most cases you're better off leaving this unset or false. */ bytes: { type: BooleanConstructor; default: boolean; }; /** Allow "javascript:" URIs in links */ allowJsUri: { type: BooleanConstructor; default: boolean; }; /** * Optional callback function that is called for each code block. * The langname parameter holds the "language tag", if any, of the block. * * The returned value is inserted into the resulting HTML verbatim, without HTML escaping. * Therefore, you should take care of properly escaping any special HTML characters. * * If the function returns null or undefined, or an exception occurs, the body will be * included as-is after going through HTML escaping. * * Note that using this callback has an adverse impact on performance as it causes * calls and data to be bridged between WASM and JS on every invocation. */ onCodeBlock: { type: PropType<(langname: string, body: string | Uint8Array) => MarkdownOutput>; }; /** Enable debug logging (default: false) */ debug: { type: BooleanConstructor; default: boolean; }; /** Output special characters as HTML entity references */ verbatimEntities: { type: BooleanConstructor; default: boolean; }; /** Disable anchor tags in headlines (default: false) */ disableHeadlineAnchors: { type: BooleanConstructor; default: boolean; }; }>, { placeholder: Ref<HTMLElement | undefined, HTMLElement | undefined>; html: Ref<MarkdownOutput, MarkdownOutput>; }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, { render: (value: MarkdownOutput) => true; }, string, PublicProps, Readonly<ExtractPropTypes< { /** Model value */ modelValue: { type: PropType<string | Uint8Array>; default: string; }; /** * HTML tag to be used for the wrapper element. */ tag: { type: StringConstructor; default: string; }; /** Customize parsing behavior with flags */ parseFlags: { type: PropType<ParseFlagsType>; default: 1 | 2 | 4 | 256 | 512 | 2048; }; /** Select the output format (HTML or XHTML). */ format: { type: PropType<"html" | "xhtml">; default: string; }; /** * bytes=true causes parse() to return the result as a Uint8Array instead of a string. * * The returned Uint8Array is only valid until the next call to parse(). * If you need to keep the returned data around, call Uint8Array.slice() to make a copy, * as each call to parse() uses the same underlying memory. * * This only provides a performance benefit when you never need to convert the output * to a string. In most cases you're better off leaving this unset or false. */ bytes: { type: BooleanConstructor; default: boolean; }; /** Allow "javascript:" URIs in links */ allowJsUri: { type: BooleanConstructor; default: boolean; }; /** * Optional callback function that is called for each code block. * The langname parameter holds the "language tag", if any, of the block. * * The returned value is inserted into the resulting HTML verbatim, without HTML escaping. * Therefore, you should take care of properly escaping any special HTML characters. * * If the function returns null or undefined, or an exception occurs, the body will be * included as-is after going through HTML escaping. * * Note that using this callback has an adverse impact on performance as it causes * calls and data to be bridged between WASM and JS on every invocation. */ onCodeBlock: { type: PropType<(langname: string, body: string | Uint8Array) => MarkdownOutput>; }; /** Enable debug logging (default: false) */ debug: { type: BooleanConstructor; default: boolean; }; /** Output special characters as HTML entity references */ verbatimEntities: { type: BooleanConstructor; default: boolean; }; /** Disable anchor tags in headlines (default: false) */ disableHeadlineAnchors: { type: BooleanConstructor; default: boolean; }; }>> & Readonly<{ onRender?: ((value: MarkdownOutput) => any) | undefined; }>, { modelValue: string | Uint8Array<ArrayBufferLike>; tag: string; parseFlags: ParseFlagsType; format: "html" | "xhtml"; bytes: boolean; allowJsUri: boolean; debug: boolean; verbatimEntities: boolean; disableHeadlineAnchors: boolean; }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>; export default VueMarkdown; export { }