Why Nostr? What is Njump?
2025-04-24 11:48:43

Râu Cao ⚡ on Nostr: Here's the bash script I created for publishing NIP-23 content. Maybe it's useful to ...

Here's the bash script I created for publishing NIP-23 content. Maybe it's useful to someone else:

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:

  • All keys except for title are optional
  • date, if present, will be set as the published_at date.
  • If published is set to true, 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.
Author Public Key
npub1raustrrh5gjwt03zdj8syn9vmt2dwsv9t467m8c3gua636uxu89svgdees