react-native-markdown-renderer
react-native-markdown-renderer copied to clipboard
Option to always parse links as a block?
First of all, thank you for a great library. I've tried a couple of other RN markdown libraries and none come close to yours. 😄
Came across a use case today that I couldn't workaround without making a modification to the code. I wanted my links to be displayed as TouchableHighlights, but the default implementation wraps links in a Text block, so by the time the custom link rule is reached, there's no way of using any View elements are since you can't nest a View inside a Text node.
To add support for this, I added a new prop to my fork of the module, parseLinksAsBlock. This gets passed through to the token cleanup utility and if set, will always mark a link as a block type. This allows us to format the link as a TouchableHighlight.
The changes can be seen here, if there is an appetite for this to be brought in to the main library I can look to add an example/documentation for a PR.