gregjacobs / Autolinker.js

Utility to Automatically Link URLs, Email Addresses, Phone Numbers, Twitter handles, and Hashtags in a given block of text/HTML
MIT License
1.48k stars 238 forks source link

Help to create Markdown Link Matcher #403

Closed jsonpreet closed 1 year ago

jsonpreet commented 1 year ago

Hi,

I am trying to make a link matcher for the markdown url:

Ordinals good or bad for Bitcoin? Supporters and opposers raise voices

{
    pattern: /\[([^\[\]]*)\]\((.*?)\)/gm,
    style: { color: '#ff00ff' },
    getLinkText: (replacerArgs) => `${replacerArgs[1]}`,
    getLinkUrl: (replacerArgs) => `${replacerArgs[3]}`,
    onPress: (match) => {
        console.log(match.getReplacerArgs()[4])
        //router.push(`/user/${match.getReplacerArgs()[1]}`);
    }
},

When click on Link it returns following code:

(@ELEMENT-6a5e7f50c2-0@)