A small JavaScript action for Drafts that applies a consistent Markdown style to the current draft. It creates a formatted copy, leaves the original and its tags alone, and produces the same result when run again.
The action follows one personal Drafts workflow, so its spacing choices may not match yours. Try it on disposable text before adopting it.
- Converts double-underscore bold to double asterisks.
- Converts single-asterisk emphasis to underscores.
- Uses
-for unordered list items. - Uses
* * *for horizontal rules. - Normalizes blank lines around headings, lists, rules, and indented code blocks.
- Create a new Drafts action.
- Add a Script step.
- Copy format-markdown.js into the script step.
- Enable Allow Asynchronous Execution for that step.
- Run the action on a sample draft and confirm the output matches your preferences.
The action creates and opens a new draft instead of overwriting the source.
The tests run the Drafts script inside a small mocked environment:
npm testMIT. See LICENSE.