I’m currently using this bash script to publish long-form content from local Markdown files to Nostr relays.
It requires all of
yq
,jq
, andnak
to be installed.Usage
Create a signed Nostr event and print it to the console:
markdown_to_nostr.sh article-filename.md
Create a Nostr event and publish it to one or more relays:
markdown_to_nostr.sh article-filename.md ws://localhost:7777 wss://nostr.kosmos.org
Markdown format
You can specify your metadata as YAML in a Front Matter header. Here’s an example file:
--- title: "Good Morning" summary: "It's a beautiful day" image: https://example.com/i/beautiful-day.jpg date: 2025-04-24T15:00:00Z tags: gm, poetry published: false --- In the blue sky just a few specks of gray In the evening of a beautiful day Though last night it rained and more rain on the way And that more rain is needed 'twould be fair to say. — Francis Duggan
The metadata keys are mostly self-explanatory. Note:
- All keys except for
title
are optionaldate
, if present, will be set as thepublished_at
date.- If
published
is set totrue
, it will publish a kind 30023 event, otherwise a kind 30024 (draft)- The
d
tag (widely used as URL slug for the article) will be the filename without the.md
extension
I'm only aware of a single issue right now, which is that nak doesn't seem to like commas in tag content. Other than that, it works just fine for me.