|
4 | 4 | [](https://www.npmjs.com/package/react-link-parser) |
5 | 5 | [](https://github.com/danbovey/react-link-parser/blob/master/LICENSE) |
6 | 6 |
|
7 | | -A tiny React component (~1KB) that parses plain text into links, emails or renders elements that **start** or **end** with a specific character or word in the way you want. |
| 7 | +A tiny React component (~1KB) that parses plain text into links, emails or renders elements that **start** or **end** with a specific character or word in the way you want. |
8 | 8 |
|
9 | 9 | ## How it works? |
10 | | -Maps over every word in the given string and matches watchers to see if it matches on watcher requirements, it uses the watcher render function. |
| 10 | + |
| 11 | +Iterates over every word in the given string and matches watchers to render it customized with matched watcher render function. |
11 | 12 |
|
12 | 13 | ## Install |
13 | 14 |
|
@@ -97,24 +98,19 @@ export function App() { |
97 | 98 | } |
98 | 99 | ``` |
99 | 100 |
|
100 | | - |
101 | 101 | ## Props |
102 | 102 |
|
103 | | -| Name | Required | Type | Default | Description | |
104 | | -| :---------------- | :------- | :----------- | :-------- | :---------------------------------------- | |
105 | | -| `children` | Yes | `Node` | | Only the text will be rendered | |
106 | | -| `newLineWatcher` | | `String` | `\\n` | If `parseNewLine` is true, what character(s) should be considered as new line. |
107 | | -| `parseNewLine` | | `Boolean` | `true` | Whether new line should be parsed as `<br />`| |
108 | | -| `watchers` | | `Array` | link watcher | An array of [watchers](#parse-tags-mentions-and-more) | |
109 | | - |
| 103 | +| Name | Required | Type | Default | Description | |
| 104 | +| :--------------- | :------- | :-------- | :--------------- | :----------------------------------------------------------------------------- | |
| 105 | +| `children` | Yes | `Node` | | Only the text will be rendered | |
| 106 | +| `newLineWatcher` | | `String` | `\\n` | If `parseNewLine` is true, what character(s) should be considered as new line. | |
| 107 | +| `parseNewLine` | | `Boolean` | `true` | Whether new line should be parsed as `<br />` | |
| 108 | +| `watchers` | | `Array` | link watcher | An array of [watchers](#parse-tags-mentions-and-more) | |
110 | 109 |
|
111 | 110 | ### Watcher props |
112 | 111 |
|
113 | | -| Name | Required | Type | Default | Description | |
114 | | -| :---------------- | :------- | :----------- | :-------- | :---------------------------------------- | |
115 | | -| `render` | Yes | `Function` | anchor | A function to customize watcher render | |
116 | | -| `type` | | `startsWith` or `endsWith` | `startsWith` | Where should it watch to find the `watchFor` clue | |
117 | | -| `watchFor` | Yes | `link` or `email` or `String` |`link` | What to look up in the string | |
118 | | - |
119 | | - |
120 | | - |
| 112 | +| Name | Required | Type | Default | Description | |
| 113 | +| :------------- | :------- | :---------------------------- | :--------------- | :------------------------------------------------ | |
| 114 | +| `render` | Yes | `Function` | anchor | A function to customize watcher render | |
| 115 | +| `type` | | `startsWith` or `endsWith` | `startsWith` | Where should it watch to find the `watchFor` clue | |
| 116 | +| `watchFor` | Yes | `link` or `email` or `String` | `link` | What to look up in the string | |
0 commit comments