Continue refactoring html content renderer (#29060)

* Splits `renderHtml` into three distict functions to prevent passing in mixed content types
* Moves the `inline` and `className` properties onto the `RenderOptions` structure
This commit is contained in:
Matt Bierner
2017-06-19 17:33:39 -07:00
committed by GitHub
parent 39b5206139
commit 7194723e62
6 changed files with 175 additions and 236 deletions

View File

@@ -12,11 +12,6 @@
*/
export type MarkedString = string | { readonly language: string; readonly value: string };
export interface IHTMLContentElementCode {
language: string;
value: string;
}
export function markedStringsEquals(a: MarkedString | MarkedString[], b: MarkedString | MarkedString[]): boolean {
if (!a && !b) {
return true;
@@ -29,9 +24,9 @@ export function markedStringsEquals(a: MarkedString | MarkedString[], b: MarkedS
if (!Array.isArray(b)) {
return false;
}
return markedStringArrEquals(<MarkedString[]>a, <MarkedString[]>b);
return markedStringArrEquals(a, b);
}
return markedStringEqual(<MarkedString>a, <MarkedString>b);
return markedStringEqual(a, b as MarkedString);
}
@@ -77,15 +72,3 @@ export function removeMarkdownEscapes(text: string): string {
}
return text.replace(/\\([\\`*_{}[\]()#+\-.!])/g, '$1');
}
export interface IHTMLContentElement {
/**
* supports **bold**, __italics__, and [[actions]]
*/
formattedText?: string;
text?: string;
className?: string;
inline?: boolean;
markdown?: string;
code?: IHTMLContentElementCode;
}