Created
October 8, 2022 15:25
-
-
Save vojtaholik/249fff11c396b252bb6485f027f4d125 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Name: Markdown to Portable Text | |
/** @type {import("@johnlindquist/kit")} */ | |
const { markdownToRichText } = await npm("@tryfabric/martian"); | |
const showdown = await npm("showdown"); | |
const input = await getSelectedText(); | |
const output = markdownToRichText(input); | |
const converter = new showdown.Converter(); | |
const html = converter.makeHtml(input, { | |
omitExtraWLInCodeBlocks: true, | |
}); | |
await exec(` | |
echo "${html}" | textutil -stdin -format html -convert rtf -stdout | pbcopy | |
`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment