iamacup / react-native-markdown-display

React Native 100% compatible CommonMark renderer
MIT License
604 stars 172 forks source link

Custom rules #217

Open amorimcode opened 5 months ago

amorimcode commented 5 months ago

Am i able to add custom rules?

  const rules = {
    video: (node, children, parent, styles) => {
      const { src } = node.attributes;

      console.log("node", node);
      return (
        <View
          key={node.key}
          style={{
            height: 210,
            marginBottom: 20,
          }}>
          <Text type="h5Bold" style={{ marginBottom: 10 }}>
            teste
          </Text>
          <YoutubePlayer height={210} videoId={"FfCp4t6jiyc"} />
        </View>
      );
    },
  };

if yes, how can i use it? what is the markdown example?

vccoffey commented 4 months ago

You can do it with a plugin. See the Plugins and Extensions section of the documentation.