the editable site (validation-lab)

This commit is contained in:
kpgarrod committed 2026-11-21 08:03:55 +01:00
commit 3ac81d5a52
13454 files changed
+2227005

No files matched your search

+84
View File
@@ -0,0 +1,84 @@
/**
* Get the plain-text value of a node.
*
* ###### Algorithm
*
* * if `tree` is a comment, returns its `value`
* * if `tree` is a text, applies normal whitespace collapsing to its
* `value`, as defined by the CSS Text spec
* * if `tree` is a root or element, applies an algorithm similar to the
* `innerText` getter as defined by HTML
*
* ###### Notes
*
* > 👉 **Note**: the algorithm acts as if `tree` is being rendered, and as if
* > we’re a CSS-supporting user agent, with scripting enabled.
*
* * if `tree` is an element that is not displayed (such as a `head`), we’ll
* still use the `innerText` algorithm instead of switching to `textContent`
* * if descendants of `tree` are elements that are not displayed, they are
* ignored
* * CSS is not considered, except for the default user agent style sheet
* * a line feed is collapsed instead of ignored in cases where Fullwidth, Wide,
* or Halfwidth East Asian Width characters are used, the same goes for a case
* with Chinese, Japanese, or Yi writing systems
* * replaced elements (such as `audio`) are treated like non-replaced elements
*
* @param {Nodes} tree
* Tree to turn into text.
* @param {Readonly<Options> | null | undefined} [options]
* Configuration (optional).
* @returns {string}
* Serialized `tree`.
*/
export function toText(tree: Nodes, options?: Readonly<Options> | null | undefined): string;
/**
* Forced break.
*/
export type BreakForce = {
/**
* Value.
*/
value: "\t" | "\n";
};
/**
* Specific break:
*
* * `0` — collapsible space
* * `1` — line ending
* * `2` — blank line
*/
export type BreakNumber = 0 | 1 | 2;
/**
* Info on current collection.
*/
export type CollectionInfo = {
/**
* Whether a row comes later in the nearest table, after the current node or
* after the row group it is in.
*/
rowAfter?: boolean | undefined;
/**
* Current whitespace setting.
*/
whitespace: Whitespace;
};
/**
* Item in a collection.
*/
export type Item = BreakForce | BreakNumber | string;
/**
* Configuration.
*/
export type Options = {
/**
* Initial CSS whitespace setting to use (default: `'normal'`).
*/
whitespace?: Whitespace | null | undefined;
};
/**
* Valid and useful whitespace values (from CSS).
*/
export type Whitespace = "normal" | "nowrap" | "pre" | "pre-wrap";
import type { Nodes } from 'hast';
//# sourceMappingURL=index.d.ts.map