Action

Text link > Markdown

Posted by @kerim, Last update over 5 years ago

Takes text followed by a URL and turns it into text.

Steps

  • script

    // define regex to use...
    
    const findRegex = /^(.*?)\s(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*))/g;
    
    // define replacement expression...
    
    const replaceWith = "[$1]($2)";
    
    // do the replacement...
    
    draft.content = draft.content.replace(findRegex, replaceWith);
    draft.update();

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.