Action

Markdown Preview with iCloud CSS

Posted by agiletortoise, Last update almost 6 years ago

Read CSS file named “markdown-style.css” in the iCloud “Drafts5” folder, and use it as the style for a Markdown preview.

Steps

  • script

    // read stylesheet from file in iCloud
    var fm = FileManager.create(false);
    var css = fm.read("markdown-style.css");
    
    // place in template tag
    draft.setTemplateTag("css", css);
    
  • htmlpreview

    <!DOCTYPE html>
    <html dir="auto">
    <head>
    <title>Preview</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
    [[css]]
    </style>
    </head>
    <body>
      %%[[draft]]%%
    </body>
    </html>
    

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.