iamacup / react-native-markdown-display

React Native 100% compatible CommonMark renderer
MIT License
564 stars 166 forks source link

Custom rules #217

Open amorimcode opened 2 months ago

amorimcode commented 2 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 1 month ago

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