🤖 Merge PR #46999 markdown-to-jsx: add definition for namedCodesToUnicode and disableParsingRawHTML by @lkuechler

This commit is contained in:
lkuechler 2020-08-24 21:06:58 +02:00 committed by GitHub
parent 0065970ce9
commit 0ea9a3ec80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -2,6 +2,7 @@
// Project: https://probablyup.github.io/markdown-to-jsx
// Definitions by: Elizabeth Craig <https://github.com/ecraig12345>
// Sun Knudsen <https://github.com/sunknudsen>
// Lasse Kuechler <https://github.com/lkuechler>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@ -80,6 +81,12 @@ export interface MarkdownOptions {
/** Custom function to generate an HTML id from headings. */
slugify?: (text: string) => string;
/** Override named html codes that should be converted to unicode characters. */
namedCodesToUnicode?: Record<string, string>;
/** By default, raw HTML is parsed to JSX. This behavior can be disabled with this option. */
disableParsingRawHTML?: boolean;
}
export function compiler(markdown: string, options?: MarkdownOptions): JSX.Element;

View File

@ -145,3 +145,18 @@ render(
# Header 1
## Header 2
`}</Markdown>;
<Markdown
options={{
namedCodesToUnicode: {
le: '\u2264',
ge: '\u2265',
},
}}
>
This text is &le; than this text.
</Markdown>;
<Markdown options={{ disableParsingRawHTML: true }}>
{"This text has <span>html</span> in it but it won't be rendered"}
</Markdown>;