|
2 | 2 |
|
3 | 3 | All notable changes will be documented in this file.
|
4 | 4 |
|
| 5 | +## 9.0.0 - unreleased |
| 6 | + |
| 7 | +### Remove `includeElementIndex` option |
| 8 | + |
| 9 | +The `includeElementIndex` option was removed, so `index` is never passed to |
| 10 | +components. |
| 11 | +Write a plugin to pass `index`: |
| 12 | + |
| 13 | +<details> |
| 14 | +<summary>Show example of plugin</summary> |
| 15 | + |
| 16 | +```jsx |
| 17 | +import {visit} from 'unist-util-visit' |
| 18 | + |
| 19 | +function rehypePluginAddingIndex() { |
| 20 | + /** |
| 21 | + * @param {import('hast').Root} tree |
| 22 | + * @returns {undefined} |
| 23 | + */ |
| 24 | + return function (tree) { |
| 25 | + visit(tree, function (node, index) { |
| 26 | + if (node.type === 'element' && typeof index === 'number') { |
| 27 | + node.properties === index |
| 28 | + } |
| 29 | + }) |
| 30 | + } |
| 31 | +} |
| 32 | +``` |
| 33 | + |
| 34 | +### Remove `rawSourcePos` option |
| 35 | + |
| 36 | +The `rawSourcePos` option was removed, so `sourcePos` is never passed to |
| 37 | +components. |
| 38 | +All components are passed `node`, so you can get `node.position` from them. |
| 39 | + |
| 40 | +### Remove `sourcePos` option |
| 41 | + |
| 42 | +The `sourcePos` option was removed, so `data-sourcepos` is never passed to |
| 43 | +elements. |
| 44 | +Write a plugin to pass `index`: |
| 45 | + |
| 46 | +<details> |
| 47 | +<summary>Show example of plugin</summary> |
| 48 | + |
| 49 | +```jsx |
| 50 | +import {stringifyPosition} from 'unist-util-stringify-position' |
| 51 | +import {visit} from 'unist-util-visit' |
| 52 | + |
| 53 | +function rehypePluginAddingIndex() { |
| 54 | + /** |
| 55 | + * @param {import('hast').Root} tree |
| 56 | + * @returns {undefined} |
| 57 | + */ |
| 58 | + return function (tree) { |
| 59 | + visit(tree, function (node) { |
| 60 | + if (node.type === 'element') { |
| 61 | + node.properties.dataSourcepos = stringifyPosition(node.position) |
| 62 | + } |
| 63 | + }) |
| 64 | + } |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +### Remove extra props passed to certain components |
| 69 | + |
| 70 | +When overwriting components, these props are no longer passed: |
| 71 | + |
| 72 | +* `inline` on `code`: |
| 73 | + — create a plugin or use `pre` for the block |
| 74 | +* `level` on `h1`, `h2`, `h3`, `h4`, `h5`, `h6` |
| 75 | + — check `node.tagName` instead |
| 76 | +* `checked` on `li` |
| 77 | + — check `task-list-item` class or check `props.children` |
| 78 | +* `index` on `li` |
| 79 | + — create a plugin |
| 80 | +* `ordered` on `li` |
| 81 | + — create a plugin or check the parent |
| 82 | +* `depth` on `ol`, `ul` |
| 83 | + — create a plugin |
| 84 | +* `ordered` on `ol`, `ul` |
| 85 | + — check `node.tagName` instead |
| 86 | +* `isHeader` on `td`, `th` |
| 87 | + — check `node.tagName` instead |
| 88 | +* `isHeader` on `tr` |
| 89 | + — create a plugin or check children |
| 90 | + |
| 91 | +## 8.0.7 - 2023-04-12 |
| 92 | + |
| 93 | +* [`c289176`](https://github.com/remarkjs/react-markdown/commit/c289176) |
| 94 | + Fix performance for keys |
| 95 | + by [**@wooorm**](https://github.com/wooorm) |
| 96 | + in [#738](https://github.com/remarkjs/react-markdown/pull/738) |
| 97 | +* [`9034dbd`](https://github.com/remarkjs/react-markdown/commit/9034dbd) |
| 98 | + Fix types in syntax highlight example |
| 99 | + by [**@dlqqq**](https://github.com/dlqqq) |
| 100 | + in [#736](https://github.com/remarkjs/react-markdown/pull/736) |
| 101 | + |
| 102 | +**Full Changelog**: <https://github.com/remarkjs/react-markdown/compare/8.0.6...8.0.7> |
| 103 | + |
5 | 104 | ## 8.0.6 - 2023-03-20
|
6 | 105 |
|
7 | 106 | * [`33ab015`](https://github.com/remarkjs/react-markdown/commit/33ab015)
|
|
0 commit comments