123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- // Type definitions for Mdast 3.0
- // Project: https://github.com/syntax-tree/mdast, https://github.com/wooorm/mdast
- // Definitions by: Jun Lu <https://github.com/lujun2>
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
- // TypeScript Version: 3.0
-
- import { Parent as UnistParent, Literal as UnistLiteral, Node } from 'unist';
-
- export type AlignType = 'left' | 'right' | 'center' | null;
-
- export type ReferenceType = 'shortcut' | 'collapsed' | 'full';
-
- export type Content =
- | TopLevelContent
- | ListContent
- | TableContent
- | RowContent
- | PhrasingContent;
-
- export type TopLevelContent =
- | BlockContent
- | FrontmatterContent
- | DefinitionContent;
-
- export type BlockContent =
- | Paragraph
- | Heading
- | ThematicBreak
- | Blockquote
- | List
- | Table
- | HTML
- | Code;
-
- export type FrontmatterContent = YAML;
-
- export type DefinitionContent = Definition | FootnoteDefinition;
-
- export type ListContent = ListItem;
-
- export type TableContent = TableRow;
-
- export type RowContent = TableCell;
-
- export type PhrasingContent = StaticPhrasingContent | Link | LinkReference;
-
- export type StaticPhrasingContent =
- | Text
- | Emphasis
- | Strong
- | Delete
- | HTML
- | InlineCode
- | Break
- | Image
- | ImageReference
- | Footnote
- | FootnoteReference;
-
- export interface Parent extends UnistParent {
- children: Content[];
- }
-
- export interface Literal extends UnistLiteral {
- value: string;
- }
-
- export interface Root extends Parent {
- type: 'root';
- }
-
- export interface Paragraph extends Parent {
- type: 'paragraph';
- children: PhrasingContent[];
- }
-
- export interface Heading extends Parent {
- type: 'heading';
- depth: 1 | 2 | 3 | 4 | 5 | 6;
- children: PhrasingContent[];
- }
-
- export interface ThematicBreak extends Node {
- type: 'thematicBreak';
- }
-
- export interface Blockquote extends Parent {
- type: 'blockquote';
- children: BlockContent[];
- }
-
- export interface List extends Parent {
- type: 'list';
- ordered?: boolean;
- start?: number;
- spread?: boolean;
- children: ListContent[];
- }
-
- export interface ListItem extends Parent {
- type: 'listItem';
- checked?: boolean;
- spread?: boolean;
- children: BlockContent[];
- }
-
- export interface Table extends Parent {
- type: 'table';
- align?: AlignType[];
- children: TableContent[];
- }
-
- export interface TableRow extends Parent {
- type: 'tableRow';
- children: RowContent[];
- }
-
- export interface TableCell extends Parent {
- type: 'tableCell';
- children: PhrasingContent[];
- }
-
- export interface HTML extends Literal {
- type: 'html';
- }
-
- export interface Code extends Literal {
- type: 'code';
- lang?: string;
- meta?: string;
- }
-
- export interface YAML extends Literal {
- type: 'yaml';
- }
-
- export interface Definition extends Node, Association, Resource {
- type: 'definition';
- }
-
- export interface FootnoteDefinition extends Parent, Association {
- type: 'footnoteDefinition';
- children: BlockContent[];
- }
-
- export interface Text extends Literal {
- type: 'text';
- }
-
- export interface Emphasis extends Parent {
- type: 'emphasis';
- children: PhrasingContent[];
- }
-
- export interface Strong extends Parent {
- type: 'strong';
- children: PhrasingContent[];
- }
-
- export interface Delete extends Parent {
- type: 'delete';
- children: PhrasingContent[];
- }
-
- export interface InlineCode extends Literal {
- type: 'inlineCode';
- }
-
- export interface Break extends Node {
- type: 'break';
- }
-
- export interface Link extends Parent, Resource {
- type: 'link';
- children: StaticPhrasingContent[];
- }
-
- export interface Image extends Node, Resource, Alternative {
- type: 'image';
- }
-
- export interface LinkReference extends Parent, Reference {
- type: 'linkReference';
- children: StaticPhrasingContent[];
- }
-
- export interface ImageReference extends Node, Reference, Alternative {
- type: 'imageReference';
- }
-
- export interface Footnote extends Parent {
- type: 'footnote';
- children: PhrasingContent[];
- }
-
- export interface FootnoteReference extends Node, Association {
- type: 'footnoteReference';
- }
-
- // Mixin
- export interface Resource {
- url: string;
- title?: string;
- }
-
- export interface Association {
- identifier: string;
- label?: string;
- }
-
- export interface Reference extends Association {
- referenceType: ReferenceType;
- }
-
- export interface Alternative {
- alt?: string;
- }
|