Action

Markdown Lists Reformat (*⇨-)

Posted by David Blue, Last update about 1 month ago

Changes (replaces) any [* ]-formatted Markdown lists in the current Draft to hyphen format (- ) via regex (/^\*\s+/gm).

Steps

  • script

    // Get the content of the current draft
    let content = draft.content;
    
    // Define a regular expression to find all instances of lists formatted with [* ]
    let regex = /^\*\s+/gm;
    
    // Replace the matches with [- ]
    let updatedContent = content.replace(regex, '- ');
    
    // Update the draft content with the new format
    draft.content = updatedContent;
    
    // Save the draft
    draft.update();

Options

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