Drafts Action Directory

Copy as Rich Text

Posted by agiletortoise, Last update 5 months ago

Convert Markdown draft to rich text and place in clipboard.

Install

Steps

  • script

    // Process Markdown to HTML
    var mmd = MultiMarkdown.create();
    var html = mmd.render(draft.content);
    
    // Wrap raw MMD output with HTML template with styles to set base fonts.
    
    var template = `<html>
    <body>
      [[content]]
    </body>
    </html>
    `;
    
    var html = template.replace("[[content]]", html);
    
    // Place in clipboard as rich-text
    if (!app.htmlToClipboard(html)) {
    	context.fail("Error rendering rich text from HTML.");
    }

Options

  • After Success Default
    Notification Info
    Log Level Info

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.