gistify-markdown

1.0.0 • Public • Published

gistify-markdown

Easily transform your Markdown documents, replacing every code block with a Gist.

I've written it for my personal use case. I'm writing blogposts on Medium which does not support syntax highlighting for code snippets. Since I'm using [iA Writer] to do that, I have source files for my blogposts which are Markdown documents.

This script takes advantage of having my blogposts as Markdown files & is replacing every code block with a gist. That's why it's missing some features (like understanding every language code and its extension) and is written in a rather crude way.

Installation

npm install -g gistify-markdown

Or if you'd like to develop this project:

git clone https://github.com/Killavus/gistify-markdown.git
cd gistify-markdown
npm install
# You can work with this project. Modify `src/` files. 
# You can then use `npm run build` to build ES2015 files to proper JS files in `build/`.

I'm using Node 5.11.0 & npm 3.10.3 to work with this project. I don't know how does it work on other versions of node. Sorry!

Usage

gistify-markdown <input file> [GitHub token]

GitHub token is not necessary (it allows you to publish gists owned by your GitHub account).

To obtain the token, issue the following request using curl:

curl -u '<your-username>' -d '{ "scopes": ["gist"], "note": "For gistify-markdown utility", "note_url": "https://github.com/Killavus/gistify-markdown" }' https://api.github.com/authorizations

If you're using two-factor auth on GitHub, the command looks like:

curl -u '<your-username>' -d '{ "scopes": ["gist"], "note": "For gistify-markdown utility", "note_url": "https://github.com/Killavus/gistify-markdown" }' -H 'X-GitHub-OTP: <your-2fa-code>' https://api.github.com/authorizations

As the response you'll get the JSON. The "token" field is what interests you - store it somewhere.

Contributing

You can use GitHub issues or make a pull request if you want to contribute to this project. See here for details.

License

ISC.

Package Sidebar

Install

npm i gistify-markdown

Weekly Downloads

6

Version

1.0.0

License

ISC

Last publish

Collaborators

  • killavus