-
-
Notifications
You must be signed in to change notification settings - Fork 848
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replace `renderers` w/ `components` * Replace `allowNode` w/ `allowElement`, which is now given a hast element (as the first parameter) * Replace `allowedTypes` w/ `allowedElements` * Replace `disallowedTypes` w/ `disallowedElements` * Change signature of `linkTarget` and `transformLinkUri`, which are now given hast children (as the second parameter) * Change signature of `transformImageUri`, which is now given the `alt` string as the second parameter (instead of the fourth) * Replace `plugins` w/ `remarkPlugins` (backwards compatible change) * Add `rehypePlugins` * Change `includeNodeIndex` to `includeElementIndex`: it still sets an `index`, but that value now represents the number of preceding elements, it also sets a `siblingCount` (instead of `parentChildCount`) with the number of sibling elements in the parent * The `columnAlignment` prop is no longer given to table elements: it’s available as `style` on `th` and `td` elements instead * The `spread` prop is no longer given to list elements: it’s already handled Remove buggy HTML parsers from core * If you want HTML, add [`rehype-raw`](https://github.com/rehypejs/rehype-raw) to `rehypePlugins` and it’ll work without bugs! * Remove `allowDangerousHtml` (previously called `escapeHtml`) option: pass `rehype-raw` in `rehypePlugins` to allow HTML instead * Remove `with-html.js`, `plugins/html-parser.js` entries from library * Remove naïve HTML parser too: either use `rehype-raw` to properly support HTML, or don’t allow it at all Closes GH-549. Closes GH-563. The following issues are solved as rehype is now available: Closes GH-522. Closes GH-465. Closes GH-427. Closes GH-384. Closes GH-356. The following issues are solved as a proper HTML parser (`rehype-raw`) is now available: Closes GH-562. Closes GH-460. Closes GH-454. Closes GH-452. Closes GH-433. Closes GH-386. Closes GH-385. Closes GH-345. Closes GH-320. Closes GH-302. Closes GH-267. Closes GH-259. The following issues are solved as docs are improved: Closes GH-251.
- Loading branch information
Showing
21 changed files
with
1,799 additions
and
1,782 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
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,43 +1,33 @@ | ||
import * as React from 'react' | ||
import * as ReactDom from 'react-dom' | ||
import * as ReactMarkdown from 'react-markdown' | ||
import * as ReactMarkdownWitHtml from 'react-markdown/with-html' | ||
|
||
/* must have children */ | ||
let test = <ReactMarkdown># header</ReactMarkdown> | ||
test = <ReactMarkdown children="# header" /> | ||
// $ExpectError | ||
test = <ReactMarkdown /> | ||
|
||
/* should support allowedTypes or disallowedTypes, but not both */ | ||
test = <ReactMarkdown allowedTypes={['heading']}># header</ReactMarkdown> | ||
test = <ReactMarkdown disallowedTypes={['heading']}># header</ReactMarkdown> | ||
/* should support allowedElements or disallowedElements, but not both */ | ||
test = <ReactMarkdown allowedElements={['h1']}># header</ReactMarkdown> | ||
test = <ReactMarkdown disallowedElements={['h1']}># header</ReactMarkdown> | ||
test = ( | ||
<ReactMarkdown disallowedTypes={['heading']} unwrapDisallowed> | ||
<ReactMarkdown disallowedElements={['h1']} unwrapDisallowed> | ||
# header | ||
</ReactMarkdown> | ||
) | ||
test = ( | ||
<ReactMarkdown allowedTypes={['heading']} unwrapDisallowed> | ||
<ReactMarkdown allowedElements={['h1']} unwrapDisallowed> | ||
# header | ||
</ReactMarkdown> | ||
) | ||
test = ( | ||
// $ExpectError | ||
<ReactMarkdown allowedTypes={['heading']} disallowedTypes={['heading']}> | ||
<ReactMarkdown allowedElements={['h1']} disallowedElements={['h1']}> | ||
# header | ||
</ReactMarkdown> | ||
) | ||
|
||
/* should support skipHtml or allowDangerousHtml, but not both */ | ||
test = <ReactMarkdown skipHtml># header</ReactMarkdown> | ||
test = <ReactMarkdown allowDangerousHtml># header</ReactMarkdown> | ||
test = ( | ||
// $ExpectError | ||
<ReactMarkdown skipHtml allowDangerousHtml> | ||
# header | ||
</ReactMarkdown> | ||
) | ||
|
||
ReactDom.render(<ReactMarkdown># header</ReactMarkdown>, document.body) | ||
ReactDom.render(<ReactMarkdownWitHtml># header</ReactMarkdownWitHtml>, document.body) |
Oops, something went wrong.