diffblazer
Version:
A super fast diffing utility for HTML and Plaintext
20 lines (19 loc) • 533 B
TypeScript
export type TextToken = {
type: 'text';
value: string;
length: number;
};
export type TagToken = {
type: 'tag-start' | 'tag-end' | 'tag-full';
name: string;
raw: string;
length: number;
};
export type Token = TextToken | TagToken;
declare const DEFAULT_ATOMIC_TAGS: string[];
/**
* Tokenizes a string of HTML.
**/
declare function tokenizeHtml(text: string, atomicTags?: string[]): Token[];
declare function joinTokens(tokens: Token[]): string;
export { joinTokens, tokenizeHtml, DEFAULT_ATOMIC_TAGS };