Publishing articles from local files to Nostr

User Avatar
Râu Cao ⚡ April 24, 2025

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, and nak 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: