@npmstuff/argdown-core
Version:
A pluggable parser for the Argdown argumentation syntax
75 lines (74 loc) • 3.16 kB
TypeScript
import { IAstNode, IRelation, RelationMember, IRange } from "./model/model";
import { IToken } from "chevrotain";
export declare const escapeHtml: (str?: string | undefined) => string | undefined;
export declare const escapeCSSWidthOrHeight: (str?: string | undefined) => string | undefined;
export declare const validateColorString: (str: string) => boolean;
export declare const validateLink: (url: string, allowFile: boolean) => boolean;
export declare const normalizeLink: (url: string) => string;
export declare const normalizeLinkText: (url: string) => string;
export declare const stringToHtmlId: (str: string) => string;
export declare const stringToClassName: (str: string) => string;
export declare const getHtmlId: (type: string, title: string, htmlIdsSet?: {
[id: string]: boolean;
} | undefined) => string;
export declare const reduceToMap: <K, V extends object>(a: V[], idProvider: (curr: V) => K) => Map<K, V>;
export declare const tokensToString: (tokens: IToken[]) => string;
export declare const tokenLocationsToString: (tokens: IToken[]) => string;
export declare const astToString: (ast: IAstNode) => string;
export declare const astToJsonString: (ast: IAstNode[]) => string;
export declare const isNumber: (x: any) => x is number;
export declare const isString: (x: any) => x is string;
export declare const isObject: (x: any) => x is object;
export declare const isFunction: (x: any) => x is Function;
export declare const stringIsEmpty: (x: any) => boolean;
export declare const arrayIsEmpty: (x: any) => boolean;
export declare const objectIsEmpty: (x: any) => boolean;
export declare function splitByCharactersInLine(s: string, n: number, useSpaces: boolean, a?: string[]): string[];
export declare const splitByLineWidth: (str: string, options: {
maxWidth?: number;
fontSize?: number;
bold?: boolean;
font?: string;
}) => string[];
export declare const addLineBreaks: (str: string, measurePixelWidth: boolean, options: {
maxWidth?: number;
charactersInLine?: number;
fontSize?: number;
font?: string;
bold?: boolean;
lineBreak?: string;
escapeAsHtmlEntities?: boolean;
applyRanges?: IRange[];
}) => {
text: string;
lines: number;
};
export declare const escapeAsHtmlEntities: (s: string) => string;
export declare const mergeDefaults: (settings: any, defaults: {
[key: string]: any;
}) => any;
declare type DefaultSettingValue<T> = DefaultSettings<T> | T | {
merge: (incoming: any) => DefaultSettingValue<T>;
};
export declare type DefaultSettings<T> = {
[K in keyof T]: DefaultSettingValue<T[K]>;
};
export declare const ensure: {
object: <T>(defaultValue: T) => {
merge: (incoming: any) => T;
};
string: (defaultValue: string) => {
merge: (incoming: any) => string;
};
number: (defaultValue: number) => {
merge: (incoming: any) => number;
};
boolean: (defaultValue: boolean) => {
merge: (incoming: any) => boolean;
};
array: (defaultValue: any[]) => {
merge: (incoming: any) => any[];
};
};
export declare const other: (r: IRelation, e: RelationMember) => RelationMember;
export {};