Action

02 ✪ > Rich Text

Last update almost 5 years ago - Unlisted

Steps

  • script

    var s = editor.getSelectedText();
    var selRange = editor.getSelectedRange();
    
    // 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><style>body{font-family:'Helvetica';font-size:100%;}</style><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
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.