sum-html
v0.0.1
Published
获取 html 的摘要
Downloads
3
Readme
sum-html
说明
export interface SumOptions {
/**
* 去除的元素,默认为 ["script", "style", "meta", "link", "noscript", "iframe", "object", "embed", "param", "base", "title", "head", "svg", "img", "canvas", "i"]
*/
removeTags?: string[];
/**
* 保留的属性,默认为 ["title", "alt", "summary", "abbr"]
*/
keepAttrs?: string[];
/**
* 当内容为空时,依旧保留的元素,主要用于保持表格结构,默认为 ["table", "tr", "td", "th", "thead", "tbody", "tfoot", "caption", "colgroup", "col"]
*/
keepTags?: string[];
}
/**
* 提取 HTML 内容的摘要
* @param html HTML 内容
* @param options 选项
* @returns 摘要
*/
export declare function sum(html: string, options?: SumOptions): Promise<string>;
export default sum;
LICENSE
MIT
