mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[html] Add types for html (#43956)
This commit is contained in:
parent
00a3022d2a
commit
031f592cc7
12
types/html/html-tests.ts
Normal file
12
types/html/html-tests.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { prettyPrint } from 'html';
|
||||
|
||||
prettyPrint('<h2><strong>Hello, <a href="http://example.com">World</a>!</strong></h2>'); // $ExpectType string
|
||||
prettyPrint('<h2><strong>Hello, <a href="http://example.com">World</a>!</strong></h2>', {}); // $ExpectType string
|
||||
prettyPrint('<h2><strong>Hello, <a href="http://example.com">World</a>!</strong></h2>', {
|
||||
brace_style: 'collapse',
|
||||
indent_scripts: 'keep',
|
||||
indent_size: 2,
|
||||
indent_char: ' ',
|
||||
max_char: 5,
|
||||
unformatted: [],
|
||||
});
|
||||
25
types/html/index.d.ts
vendored
Normal file
25
types/html/index.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
// Type definitions for html 1.0
|
||||
// Project: https://github.com/maxogden/commonjs-html-prettyprinter
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface PrintOptions {
|
||||
/**
|
||||
* Put braces on the same line as control statements (`collapse`),
|
||||
* or put braces on own line (Allman / ANSI style, `expand`),
|
||||
* or just put end braces on own line (`end-expand`). Default: `collapse`.
|
||||
*/
|
||||
brace_style?: 'collapse' | 'expand' | 'end-expand';
|
||||
/** Default: `normal`. */
|
||||
indent_scripts?: 'keep' | 'separate' | 'normal';
|
||||
/** indentation size. Default: 4. */
|
||||
indent_size?: number;
|
||||
/** character to indent with. Default: " " (space). */
|
||||
indent_char?: string;
|
||||
/** Maximum amount of characters per line. Default: 70. */
|
||||
max_char?: number;
|
||||
/** list of tags, that shouldn't be reformatted. Defaults to inline tags. */
|
||||
unformatted?: string[];
|
||||
}
|
||||
|
||||
export function prettyPrint(htmlSource: string, options?: PrintOptions): string;
|
||||
23
types/html/tsconfig.json
Normal file
23
types/html/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"html-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/html/tslint.json
Normal file
1
types/html/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user