Publish markdown
Publish articles written in Markdown files to the following platforms:
- medium.com
- dev.to
Markdown files should include YAML frontmatter with at least a title. Adding tags will help your posts reach a wider audience on the target platforms:
---
title: Some title or other
tags: ["webdev", "writing"]
---
{content in Markdown}
I wrote this to cross-post article from my own Jekyll blog, in a GitHub workflow (which I may yet publish as an action).
Installation
$ pip3 install publish-markdown
Publishing to medium.com
$ export MEDIUM_TOKEN={your-integration-token}
$ publish-to-medium _posts/2022-01-01-my-first-post.md --canonical-url="https://my-blog.com/2022/01/02/my-first-post"
Found user ID: {your-user-id}
- Article published at https://medium.com/@auser/my-first-post-50134f3aeba0
- Added 'medium.com' to 'published_to' metadata
Optimisations
You can avoid the code having to retrieve your user ID every time by setting it as an environment variable as well:
export MEDIUM_USER_ID={your-user-id}
Publishing to dev.to
$ export DEV_TO_TOKEN={your-api-token}
$ publish-to-DEV _posts/2022-01-01-my-first-post.md --canonical-url="https://my-blog.com/2022/01/02/my-first-post"
- Article published at https://dev.to/auser/my-first-post-74n
- Added 'dev.to' to 'published_to' metadata
Is cross-posting allowed / a good idea?
Cross-posting to extra platforms gets your post to be seen by more communities. This is mostly a good thing - people in one community are unlikely to also be in another simultaneously.
While plainly duplicating content on the internet is not generally a good idea, cross-posting or syndicating is fine where it's done right. Dev.to, Medium and Hashnode all explicitly support cross-posting, by providing the ability to set a rel=canonical meta tag inside their posts. And Google explicitly mention syndication of articles as a legitimate use of the rel=canonical tag.
So yes, cross-posting is a good idea.
Metadata
Release files for publish-markdown 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| publish-markdown-0.2.1.tar.gz | 4.3 kB | Details |
Release files / publish-markdown-0.2.1.tar.gz
| Download URL | publish-markdown-0.2.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc0088a7301a24283957bb9e8d86d8d89b92a76af7efe07c1ea3f738cb9c6265
|
|
BLAKE2b-256 checksum How to use checksums |
d3b211dce18b56df68a2adf9599d8c097879dafff5b59e895e559281ae108b4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|