gramdown
v1.0.0
Published
Turn a Grammarly .docx export into clean, GitHub-Flavored Markdown, from the command line.
Maintainers
Readme
gramdown converts the .docx file you get from Grammarly's export into clean, GitHub-Flavored Markdown. It is a command line tool, it is pure JavaScript, and it has no system dependencies: nothing to install alongside it.
Install
npm install -g gramdownOr run it without installing anything:
npx gramdown draft.docx -o draft.mdNo Node.js on your machine? Download a standalone binary for Linux, macOS or Windows: a single file that runs on its own.
Use
# print the Markdown to your terminal
gramdown draft.docx
# write it to a file instead
gramdown draft.docx -o draft.md
# guess a language for each code block
gramdown draft.docx -o draft.md --guess-lang
# pipe it somewhere else
gramdown draft.docx | pbcopyOptions
| Flag | Description |
| ----------------------- | -------------------------------------------------------------- |
| -o, --output <file> | Write the Markdown to <file> instead of stdout. |
| --guess-lang | Label each code fence with a guessed language. Off by default. |
| -h, --help | Print usage and exit. |
| -v, --version | Print the bare version string and exit. |
Without -o the Markdown goes to stdout and nothing else does, so redirecting and piping both work cleanly. Warnings go to stderr and don't change the exit code. The CLI reference has every exit code and error case.
Why a Grammarly-specific converter?
A Grammarly export is a Word document, but not a tidy one. It is awkward in a few consistent ways: code is ordinary body text in a monospace font, indented with invisible non-breaking spaces, and every hyperlink arrives underlined. A general-purpose markdown converter reads all these things literally meaning you're left with a document that needs cleaning manually.
gramdown only ever has to handle this one input source, so it's instead expecting those quirks. How it works has the detail, including where it still has limits.
Other ways to run it
- In your browser. Drop a
.docxanywhere on gramdown.tobythe.dev and it converts on your device. Nothing is uploaded, and there is nothing to install. - From your own code.
@gramdown/coreis the conversion engine this command wraps: pure, I/O-free, and usable in Node, a bundler or a Web Worker.
Documentation
Everything is at gramdown.tobythe.dev/docs: the CLI reference, standalone downloads, the convert() API and how it works.
License
ISC. See LICENSE.md.
