iamacup / react-native-markdown-display

React Native 100% compatible CommonMark renderer
MIT License
590 stars 169 forks source link

escaped text appears #149

Closed trajano closed 10 months ago

trajano commented 3 years ago

I have a string

1 + 1 >= 2
```

But when I use markdown, I get the `>` escaped as `>`

![image](https://user-images.githubusercontent.com/110627/132296801-294f7e7d-b090-4e35-9406-f6e6d1db59b1.png)

My workaround is to override code_inline and code_block to call `decode` from `html-entities`
code_inline: (
  node: Parameters<RenderFunction>[0],
  children: Parameters<RenderFunction>[1],
  parent: Parameters<RenderFunction>[2],
  styles: Parameters<RenderFunction>[3],
  inheritedStyles: StyleProp<TextStyle> = {}
): ReturnType<RenderFunction> => (
  <Text key={node.key} fontFamily="mono" style={[inheritedStyles, styles.code_line]}>
    {decode(node.content)}
  </Text>
),