markdown2medium

command module
v0.1.12-0...-cdc76dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

README

build

markdown2medium

Inspired by cjoudrey/md2medium, I want a simple way to re-publish in Medium some Markdown posts written for Hugo. This tool uploads a single post to Medium.

Prerequisites

An Integration Token from Medium. Go to Settings, then Integration tokens.

Integration Token menu

Type something mnemonic, like markdown2medium and click on Get integration token.

Get integration token

The integration token is now available until you explicitly revoke it.

Integration Token and Revoke button

Download

For Linux

$ver = '0.1.1'
curl -L https://github.com/kpango/markdown2medium/releases/download/v${ver}/markdown2medium-${ver}-linux-x64 -o markdown2medium
chmod +x markdown2medium
./markdown2medium -h

For Windows

$ver = '0.1.1'
Invoke-WebRequest https://github.com/kpango/markdown2medium/releases/download/v${ver}/markdown2medium-${ver}-win-x64.exe -OutFile markdown2medium.exe
./markdown2medium -h

Usage

The options should be self-explanatory. Use markdown2medium -h to get the list of possible options.

At a minimum, you have to pass --mediumIntegrationToken (Medium authentication) and --markdownFile (the post to upload). By default, the post is published as draft; the --publishStatus option allows for a public or an unlisted post.

--canonicalURL sets the URL of original post and --originalNote appends some Markdown at the post, typically to link back to the original post. The --originalNote option accepts Go Templates and can use these properties:

Property Description
BaseURL scheme and hostname of canonical URL
CanonicalURL Post canonical URL as defined by --canonicalURL option
Title Post title extracted from Front Matter
Date Post date extracted from Front Matter

Use --dryRun to check that the input file is correct and --debug to dump the exact HTML that will be uploaded to Medium.

Sample usage
markdown2medium                                                                                                     \
    --mediumIntegrationToken 1234567890abcdef1234567890abcdef123457890abcdef123456789abcdef1234                     \
    --markdownFile C:/myblog/content/post/2019/pyp/1-hosts/index.md                                                 \
    --canonicalURL http://blog.casavian.eu/2019/08/23/meta-pipelines-part-1-docker-hosts/                           \
    --publishStatus draft                                                                                           \
    --originalNote 'Originally posted at [{{ .BaseURL }}]({{ .CanonicalURL }}) on {{ .Date.Format \"2 Jan 2006\" }}'

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
source https://github.com/jschaf/b2/
source https://github.com/jschaf/b2/

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL