Action

Send to Remarkable

Posted by enivrezvous, Last update 12 months ago

UPDATES

12 months ago

Update with easier to read script in case you want to change anything in the setup, of the format the script has as an output.

Action is functionally a copy of raigmcclellan’s PDF Export action. The script has been rewritten and repurposed for Remarkable.

Takes a draft and sends to Remarkable as a PDF using iPhone shortcuts.

Use shortcut: https://www.icloud.com/shortcuts/862d5105692f49c0b7680b4eeb05d502

Steps

  • script

    // Convert Markdown to HTML
    var markdownConverter = MultiMarkdown.create();
    var htmlContent = markdownConverter.render(draft.content);
    
    // Define an HTML template with styles to set base fonts
    var htmlTemplate = "<html><style>body{font-family:'Avenir Next';font-size:100%;line-height: 1.5;}</style><body>[[content]]</body></html>";
    
    // Replace the [[content]] placeholder in the template with the HTML content
    var finalHTML = htmlTemplate.replace("[[content]]", htmlContent);
    
    // Set draft template tag for use in the workflow
    draft.setTemplateTag("script_content", finalHTML);
    
    // Optionally, handle errors during conversion or template replacement
    if (!finalHTML) {
        console.log("Error: Markdown to HTML conversion or template replacement failed.");
    }
  • runWorkflow

    workflowName
    Draft to Remarkable
    waitForResponse
    false

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.