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.levelheadingLevel = "#".repeat(level)if (level === 1){itemString = "+ " + headingLevel + " " + item.topictopics.push(itemString)if(item.note){noteString = tab + "> " + item.notetopics.push(noteString)}} else if (level > 1){indent = tab.repeat(level-1)itemString = indent + "+ " + headingLevel + " " + item.topictopics.push(itemString)if(item.note){indent = tab.repeat(level)noteString = indent + "> " + item.notetopics.push(noteString)}}})Pasteboard.general.string = topics.join('\n')URL.fromString("craftdocs://").open()});action.validate = function(selection, sender){return (rootItem.descendants.length > 0)}return action})();