UNPKG

2.25 kBTypeScriptView Raw
1import type { AbbreviationAttribute, AbbreviationNode } from '@emmetio/abbreviation';
2import type { Config, Options } from './config.js';
3export interface OutputStream {
4 options: Options;
5 value: string;
6 level: number;
7 offset: number;
8 line: number;
9 column: number;
10}
11export declare const expressionStart = "{";
12export declare const expressionEnd = "}";
13export default function createOutputStream(options: Options, level?: number): OutputStream;
14/**
15 * Pushes plain string into output stream without newline processing
16 */
17export declare function push(stream: OutputStream, text: string): void;
18/**
19 * Pushes given string with possible newline formatting into output
20 */
21export declare function pushString(stream: OutputStream, value: string): void;
22/**
23 * Pushes new line into given output stream
24 */
25export declare function pushNewline(stream: OutputStream, indent?: boolean | number): void;
26/**
27 * Adds indentation of `size` to current output stream
28 */
29export declare function pushIndent(stream: OutputStream, size?: number): void;
30/**
31 * Pushes field/tabstop into output stream
32 */
33export declare function pushField(stream: OutputStream, index: number, placeholder: string): void;
34/**
35 * Returns given tag name formatted according to given config
36 */
37export declare function tagName(name: string, config: Config): string;
38/**
39 * Returns given attribute name formatted according to given config
40 */
41export declare function attrName(name: string, config: Config): string;
42/**
43 * Returns character for quoting value of given attribute
44 */
45export declare function attrQuote(attr: AbbreviationAttribute, config: Config, isOpen?: boolean): string;
46/**
47 * Check if given attribute is boolean
48 */
49export declare function isBooleanAttribute(attr: AbbreviationAttribute, config: Config): boolean;
50/**
51 * Returns a token for self-closing tag, depending on current options
52 */
53export declare function selfClose(config: Config): string;
54/**
55 * Check if given tag name belongs to inline-level element
56 * @param node Parsed node or tag name
57 */
58export declare function isInline(node: string | AbbreviationNode, config: Config): boolean;
59/**
60 * Splits given text by lines
61 */
62export declare function splitByLines(text: string): string[];