foremark
Version:
A technology for writing semi-plain text documents that extends upon the concept of Markdeep.
26 lines (25 loc) • 1.02 kB
TypeScript
/**
* Removes the prefix `prefix` from a string `s` with a graceful error handling.
*/
export declare function removePrefix(s: string, prefix: string): string;
export declare const enum IndentCommand {
Preserve = 0,
Indent = 1,
Outdent = 2
}
/**
* Analyze the change in the indentation level.
*
* # Examples
*
* - `analyzeIndent("\t\t", "\t")` returns `Indent`. In this case, `indent`
* has a prefix `ref` and an extra character.
* - `analyzeIndent("\t", "\t\t")` returns `Outdent`. In this case, `indent`
* is a prefix of `ref` and is shorter than `ref`.
* - `analyzeIndent("\t\t", "\t\t")` returns `Preserve`.
* - `analyzeIndent("\t\t", " ")` returns `Outdent`. In this case, the common
* longest prefix of `indent` and `ref` is shorter than `ref`.
*/
export declare function analyzeIndent(indent: string, ref: string): IndentCommand;
export declare function escapeRegExp(x: string): string;
export declare function truncateStringWithEllipsisSign(x: string, len: number): string;