@markdoc/markdoc

Search for an npm package

@markdoc/markdoc

module "@markdoc/markdoc" {
export function parse(content: string | import("markdown-it").Token[], args?: string | ParserArgs): default
Referenced by
  • default
export function resolve<C extends Config = Config>(content: default, config: C): default
export function resolve<C extends Config = Config>(content: default[], config: C): default[]
Referenced by
export function transform<C extends Config = Config>(node: default, config?: C): RenderableTreeNode
export function transform<C extends Config = Config>(nodes: default[], config?: C): RenderableTreeNode[]
Referenced by
export function validate<C extends Config = Config>(node: default, options?: C): ValidateError[]
Referenced by
export function createElement(name: string | {
key?: string | number;
}, attributes?: {}, ...children: any[]): {
name: string | {
key?: string | number | undefined;
};
attributes: {};
children: any[];
}
Referenced by
export * as nodes from {
export const document: Schema = ...
export const heading: Schema = ...
export const paragraph: Schema = ...
export const image: Schema = ...
export const fence: Schema = ...
export const blockquote: Schema = ...
export const item: Schema = ...
export const list: Schema = ...
export const hr: Schema = ...
export const table: Schema = ...
export const td: Schema = ...
export const th: Schema = ...
export const tr: Schema = ...
export const tbody: Schema = ...
export const thead: Schema = ...
export const strong: Schema = ...
export const em: Schema = ...
export const s: Schema = ...
export const inline: Schema = ...
export const link: Schema = ...
export const code: Schema = ...
export const text: Schema = ...
export const hardbreak: Schema = ...
export const softbreak: Schema = ...
export const comment: {
attributes: {
content: {
type: StringConstructor;
required: boolean;
};
};
} = ...
export const error: {} = ...
export const node: {} = ...
}
Referenced by
export const tags: {
else: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
if: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
partial: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
slot: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
table: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
} = ...
export const functions: {
default: ConfigFunction;
} = ...
export const globalAttributes: AttributesSchema = ...
Unexported symbols referenced here
type AttributesSchema = Schema["attributes"]
Referenced by
export const transforms: (typeof default)[] = ...
Unexported symbols referenced here
function transform(document: default): void
Referenced by
export const renderers: {
html: typeof default;
react: typeof default;
reactStatic: typeof default;
} = ...
Unexported symbols referenced here
function render(node: RenderableTreeNodes): string
Referenced by
function dynamic(node: RenderableTreeNodes, React: ReactShape, { components }?: {
components?: {} | undefined;
}): import("react").ReactNode
Referenced by
function reactStatic(node: RenderableTreeNodes): string
Referenced by
type ReactShape = Readonly<{
createElement: typeof import("react").createElement;
Fragment: typeof import("react").Fragment;
}>
Referenced by
export const Ast: {
fromJSON: typeof fromJSON;
isAst(value?: any): value is AstType;
isFunction(value?: any): value is default;
isVariable(value?: any): value is default;
getAstValues(value: any): Generator<AstType, void, unknown>;
resolve(value: any, config?: Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>): any;
Function: typeof default;
Node: typeof default;
Variable: typeof default;
} = ...
Unexported symbols referenced here
function fromJSON(text: string): default | default[]
Referenced by
class Function implements AstType {
constructor(name: string, parameters: Record<string, any>)
readonly $$mdtype: "Function";
name: string;
parameters: Record<string, any>;
resolve(config?: Config): any;
}
Referenced by
class Variable implements AstType {
constructor(path?: (string | number)[])
readonly $$mdtype: "Variable";
path: (string | number)[];
resolve({ variables }?: Config): any;
}
Referenced by
export class Tag<N extends string = string, A extends Record<string, any> = Record<string, any>> {
constructor(name?: N, attributes?: A, children?: RenderableTreeNode[])
readonly $$mdtype: "Tag";
static isTag: (tag: any) => tag is default<string, Record<string, any>>;
name: N;
attributes: A;
children: RenderableTreeNode[];
}
Referenced by
export class Tokenizer {
constructor(config?: import("markdown-it").Options & {
allowIndentation?: boolean;
allowComments?: boolean;
})
tokenize(content: string): import("markdown-it").Token[];
}
Referenced by
export function parseTags(content: string, firstLine?: number): import("markdown-it").Token[]
Referenced by
export const transformer: Transformer = ...
export function validator(node: default, config: Config): ValidationError[] | Promise<ValidationError[]>
Referenced by
export function truthy(value: any): boolean
Referenced by
export function format(v: Value, options?: Options): string
Referenced by
Unexported symbols referenced here
type Options = {
allowIndentation?: boolean;
maxTagOpeningWidth?: number;
parent?: default;
indent?: number;
}
Referenced by
export class default {
constructor(config: Config)
static tags: {
else: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: import("@markdoc/markdoc").default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
if: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: import("@markdoc/markdoc").default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
partial: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: import("@markdoc/markdoc").default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
slot: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: import("@markdoc/markdoc").default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
table: Schema<Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: import("@markdoc/markdoc").default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>, string>;
};
static functions: {
default: ConfigFunction;
};
static globalAttributes: Record<string, SchemaAttribute> | undefined;
static renderers: {
html: typeof default;
react: typeof default;
reactStatic: typeof default;
};
static transforms: typeof default[];
static Ast: {
fromJSON: (text: string) => import("@markdoc/markdoc").default | import("@markdoc/markdoc").default[];
isAst(value?: any): value is AstType;
isFunction(value?: any): value is default;
isVariable(value?: any): value is default;
getAstValues(value: any): Generator<AstType, void, unknown>;
resolve(value: any, config?: Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: import("@markdoc/markdoc").default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>): any;
Function: typeof default;
Node: typeof import("@markdoc/markdoc").default;
Variable: typeof default;
};
static Tag: typeof import("@markdoc/markdoc").default;
static Tokenizer: typeof import("@markdoc/markdoc").default;
static parseTags: typeof parseTags;
static transformer: Transformer;
static validator: typeof import("@markdoc/markdoc").default;
static parse: typeof parse;
static transform: typeof transform;
static validate: typeof validate;
static createElement: typeof createElement;
static truthy: typeof truthy;
static format: typeof import("@markdoc/markdoc").default;
config: Readonly<Partial<{
nodes: Partial<Record<NodeType, Schema<Readonly<Partial<any>>, string>>>;
tags: Record<string, Schema<Readonly<Partial<any>>, string>>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: import("@markdoc/markdoc").default[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
}>>;
parse: typeof parse;
resolve: (content: Parameters<typeof resolve>[0]) => import("@markdoc/markdoc").default[];
transform: (content: Parameters<typeof transform>[0]) => RenderableTreeNode[];
validate: (content: Parameters<typeof validate>[0]) => ValidateError[];
}
export class Node implements AstType {
constructor(type?: NodeType, attributes?: Record<string, any>, children?: default[], tag?: string)
readonly $$mdtype: "Node";
attributes: Record<string, any>;
slots: Record<string, default>;
children: default[];
errors: ValidationError[];
lines: number[];
type: NodeType;
tag?: string;
annotations: AttributeValue[];
inline: boolean;
location?: Location;
walk(): Generator<default, void, unknown>;
push(node: default): void;
resolve(config?: Config): default;
findSchema(config?: Config): Schema | undefined;
transformAttributes(config?: Config): Record<string, any>;
transformChildren(config: Config): RenderableTreeNode[];
}
Referenced by
export type Function = default
export type Variable = default
export type MaybePromise<T> = T | Promise<T>
Referenced by
export interface AstType {
readonly $$mdtype: "Function" | "Node" | "Variable";
resolve(config: Config): any;
}
Referenced by
export type AttributeValue = {
type: string;
name: string;
value: any;
}
Referenced by
export type ConfigType = Partial<{
nodes: Partial<Record<NodeType, Schema>>;
tags: Record<string, Schema>;
variables: Record<string, any>;
functions: Record<string, ConfigFunction>;
partials: Record<string, any>;
validation?: {
parents?: default[];
validateFunctions?: boolean;
environment?: string;
};
}>
Referenced by
export type ConfigFunction = {
parameters?: Record<string, SchemaAttribute>;
transform(parameters: Record<string, any>, config: Config): any;
validate(fn: default, config: Config): ValidationError[];
}
Referenced by
export interface CustomAttributeTypeInterface {
transform(value: any, config: Config): Scalar;
validate(value: any, config: Config, name: string): ValidationError[];
}
Referenced by
export interface CustomAttributeType {
readonly prototype: CustomAttributeTypeInterface;
}
Referenced by
export type Location = {
file?: string;
start: LocationEdge;
}
Referenced by
export type LocationEdge = {
line: number;
character?: number;
}
Referenced by
export type NodeType = "blockquote" | "code" | "comment" | "document" | "em" | "error" | "fence" | "hardbreak" | "heading" | "hr" | "image" | "inline" | "item" | "link" | "list" | "node" | "paragraph" | "s" | "softbreak" | "strong" | "table" | "tag" | "tbody" | "td" | "text" | "th" | "thead" | "tr"
Referenced by
export type Primitive = null | boolean | number | string
Referenced by
export type Scalar = Primitive | Scalar[] | {
[key: string]: Scalar;
}
Referenced by
export type Schema<C extends Config = Config, R = string> = {
render?: R;
children?: string[];
attributes?: Record<string, SchemaAttribute>;
slots?: Record<string, SchemaSlot>;
selfClosing?: boolean;
inline?: boolean;
transform(node: default, config: C): MaybePromise<RenderableTreeNodes>;
validate(node: default, config: C): MaybePromise<ValidationError[]>;
description?: string;
}
Referenced by
export type SchemaAttribute = {
render?: boolean | string;
default?: any;
required?: boolean;
matches?: SchemaMatches | ((config: Config) => SchemaMatches);
validate(value: any, config: Config, name: string): ValidationError[];
errorLevel?: ValidationError["level"];
description?: string;
}
Referenced by
export type SchemaMatches = RegExp | string[] | null
Referenced by
export type SchemaSlot = {
render?: boolean | string;
required?: boolean;
}
Referenced by
export interface Transformer {
findSchema(node: default, config: Config): Schema | undefined;
attributes(node: default, config: Config): Record<string, any>;
children(node: default, config: Config): RenderableTreeNode[];
}
Referenced by
export type ValidationError = {
id: string;
level: "debug" | "info" | "warning" | "error" | "critical";
message: string;
location?: Location;
}
Referenced by
export type ValidateError = {
type: string;
lines: number[];
location?: Location;
}
Referenced by
export type ValidationType = CustomAttributeType | typeof String | typeof Number | typeof Boolean | typeof Object | typeof Array | "String" | "Number" | "Boolean" | "Object" | "Array"
Referenced by
export type Value = AstType | Scalar
Referenced by
export type ParserArgs = {
file?: string;
slots?: boolean;
location?: boolean;
}
Referenced by
}