-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move html out of index, add class Raw and document
- Loading branch information
Showing
2 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
declare global { | ||
namespace mw { | ||
namespace html { | ||
/** | ||
* Escape a string for HTML. | ||
* Converts special characters to HTML entities. | ||
* @param {string} s The string to escape | ||
* @returns {string} HTML | ||
*/ | ||
function escape(s: string): string; | ||
|
||
/** | ||
* Create an HTML element string, with safe escaping. | ||
* @param {string} name The tag name | ||
* @param {{ [key: string]: string }} attrs An object with members mapping element names to values | ||
* @param {string | html.Raw} contents The contents of the element | ||
* @returns {string} HTML | ||
*/ | ||
function element( | ||
name: string, | ||
attrs?: Record<string, string>, | ||
contents?: string | mw.html.Raw | ||
): string; | ||
|
||
/** | ||
* Wrapper object for raw HTML passed to mw.html.element(). | ||
*/ | ||
class Raw<V extends string = string> { | ||
constructor(value: V); | ||
private value: V; | ||
} | ||
} | ||
} | ||
} | ||
|
||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters