×

OmniOutliner: Outline as “Craft-compatible” Markdown

This Omni Automation plug-in for OmniOutliner generates “Craft-compatible” markdown text of the current outline to the clipboard.

Copy Outline as “Craft-compatible” Markdown
Copy the document contents to clipboard in “Craft-compatible” markdown format.

Return to: Omni Automation and Craft

Copy Document as “Craft-compatible” Markdown
 

/*{ "type": "action", "targets": ["omnioutliner"], "identifier": "com.omni-automation.oo.craft-compatible-markdown", "author": "Otto Automator", "description": "Copy the document contents to clipboard in “Craft-compatible” markdown format.", "version": "1.0", "label": "Copy as Markdown for Craft", "shortLabel": "Markdown for Craft", "paletteLabel": "Markdown for Craft", "image": "list.bullet" }*/ (() => { var action = new PlugIn.Action(function(selection, sender){ var topics = new Array() var tab = " " rootItem.descendants.forEach(item => { level = item.level headingLevel = "#".repeat(level) if (level === 1){ itemString = "+ " + headingLevel + " " + item.topic topics.push(itemString) if(item.note){ noteString = tab + "> " + item.note topics.push(noteString) } } else if (level > 1){ indent = tab.repeat(level-1) itemString = indent + "+ " + headingLevel + " " + item.topic topics.push(itemString) if(item.note){ indent = tab.repeat(level) noteString = indent + "> " + item.note topics.push(noteString) } } }) Pasteboard.general.string = topics.join('\n') URL.fromString("craftdocs://").open() }); action.validate = function(selection, sender){ return (rootItem.descendants.length > 0) } return action })();