UNPKG

@vivliostyle/vfm

Version:

Custom Markdown syntax specialized in book authoring.

74 lines (73 loc) 2.52 kB
/** Attribute of HTML tag. */ export declare type Attribute = { /** Name. */ name: string; /** Value. */ value: string; }; /** Settings of VFM. */ export declare type VFMSettings = { /** Enable math syntax. */ math?: boolean; /** Output markdown fragments. */ partial?: boolean; /** Add `<br>` at the position of hard line breaks, without needing spaces. */ hardLineBreaks?: boolean; /** Disable automatic HTML format. */ disableFormatHtml?: boolean; /** Path of theme. */ theme?: string; /** Enable TOC mode. */ toc?: boolean; }; /** Metadata from Frontmatter. */ export declare type Metadata = { /** Value of `<html id="...">`. */ id?: string; /** Value of `<html lang="...">`. */ lang?: string; /** Value of `<html dir="...">`. e.g. `ltr`, `rtl`, `auto`. */ dir?: string; /** Value of `<html class="...">`. */ class?: string; /** Value of `<title>...</title>`. */ title?: string; /** * Attributes of `<html>`. * The `id`,` lang`, `dir`, and` class` specified in the root take precedence over the value of this property. */ html?: Array<Attribute>; /** Attributes of `<body>`. */ body?: Array<Attribute>; /** Attributes of `<base>`. */ base?: Array<Attribute>; /** Attribute collection of `<meta>`. */ meta?: Array<Array<Attribute>>; /** Attribute collection of `<link>`. */ link?: Array<Array<Attribute>>; /** Attribute collection of `<script>`. */ script?: Array<Array<Attribute>>; /** VFM settings. */ vfm?: VFMSettings; /** `<style>...</style>`, reserved for future use. */ style?: string; /** `<head>...</head>`, reserved for future use. */ head?: string; /** * A set of key-value pairs that are specified in `readMetadata` not to be processed as `<meta>`. * The data types converted from Frontmatter's YAML are retained. * Use this if want to add custom metadata with a third party tool. */ custom?: { [key: string]: any; }; }; /** * Read metadata from Markdown frontmatter. * * Keys that are not defined as VFM are treated as `meta`. If you specify a key name in `customKeys`, the key and its data type will be preserved and stored in `custom` instead of `meta`. * @param md Markdown. * @param customKeys A collection of key names to be ignored by meta processing. * @returns Metadata. */ export declare const readMetadata: (md: string, customKeys?: string[]) => Metadata;