Sublime Medium
Medium publishing plug-in for developers
 
 
 
 

Sublime Medium Publisher is a Sublime Text plug-in for software developers that post on Medium platform.

It makes your life much easier if you include a lot of code examples in your posts:

  • Automatically creates Github Gists from all code blocks.
  • Replaces plain markdown blocks with formatted Gist frames.
  • Allows you to quickly update all code samples to what’s in your markdown file.

screenshot

Usage

You can find plug-in actions in your command palette (Tools -> Command Palette...). Just pick one.

Publish to Medium (as Draft)

It will publish all your code blocks to separate Gists and insert comments at the beginning of each with Gist ID, so we can update them later. Don’t worry, we won’t publish these comments, they are removed just before publishing.

Then it will publish file as Medium draft, with all code blocks replaced by Gist URLs. These are then processed by Medium and replaced by nice syntax-colored frames.

Note: Unfortunately Medium does not support post updates via API, so we are unable to update your post. Each time you call this action we will create a new draft.

Post metadata

Before publish you might want to setup some metadata like title or tags. You can do it using header like Jekyll front matter at the beginning of the file. Here is an example with all tags that we support:

---
title: Title for your publication
tags: comma, separated, list, of, tags
canonical_url: http://official-url-of-the-post.com
license: License for your content
---

You can skip any of them or don’t provide front matter at all. Medium Publisher will just create draft with file name as title and no tags if you won’t provide it.

Publish or Update Gists

This command will only do the first part - upload code samples to Gist. If they have a Gist ID in the first line, they will be updated instead of creating new one.

Installation

Via Package Control

Recommended way to install Medium Publisher is to use Package Control directly from Sublime. In case that you don’t have Package Control already installed, just follow the installation guide on the Package Control website.

Installation steps:

  1. Open the Command Palette (Tools -> Command Palette)
  2. Type install package and select Package Control: Install Package
    install-package
  3. Pick “Medium Publisher
  4. Setup your access keys

Manually

If you don’t want to use Package Control you can also manually fetch and install Medium Publisher:

  1. Download zipped package: medium_publisher-1.0.0.sublime-package
  2. Extract it to local packages directory

The packages directory can be found in:

Linux: ~/.config/sublime-text-3/Packages
OS X: ~/Library/Application Support/Subime Text 3/Packages
Windows: %APPDATA%\\Sublime Text 3

Configuration

Medium publisher requires you to configure access keys for Gist and Medium APIs. Without them it cannot publish anything on your accounts.

You can configure them in usual package settings:

  1. Open (Preferences -> Package Settings -> Medium Publisher)
  2. Insert your Gist and Medium keys:
{
  "medium_token": "your-medium-token",
  "gist_key": "your-gist-key"
}

Generate access tokens

To generate Medium token:

  1. Go to your Medium account settings
  2. Scroll to “Integration tokens” section
  3. Give your token a name (ex: Sublime Medium)
  4. Click “Get integration token””
  5. Copy your new token

To generate Github Gist key:

  1. Open Github tokens settings
  2. Give your token a name (ex: Sublime Medium)
  3. Pick “gists
  4. Click “Generate token
  5. Copy your new token

Support

If you need help just drop us an email at [email protected]

 
 
ALL RIGHT RESERVED BY DAYONE 2017