Râu Cao ⚡ on Nostr: I'm currently using [this bash script][1] to publish [long-form content][2] from ...
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
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
Published at
2025-04-25 09:27:02Event JSON
{
"id": "1a49324e508e44fe32c71d3c07a4fd339f80c28ab071d60baafb1946fdaef769",
"pubkey": "1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb",
"created_at": 1745573222,
"kind": 30023,
"tags": [
[
"title",
"Publishing articles from local files to Nostr"
],
[
"summary",
"A hacky bash script using yq, jq, and nak"
],
[
"published_at",
"1745498100"
],
[
"t",
"nostr"
],
[
"t",
"nip-23"
],
[
"d",
"2025-04-24-markdown-to-nostr"
]
],
"content": "I'm currently using [this bash script][1] to publish [long-form content][2]\nfrom local Markdown files to Nostr relays.\n\nIt requires all of `yq`, `jq`, and `nak` to be installed.\n\n## Usage\n\nCreate a signed Nostr event and print it to the console:\n\n markdown_to_nostr.sh article-filename.md\n\nCreate a Nostr event and publish it to one or more relays:\n\n markdown_to_nostr.sh article-filename.md ws://localhost:7777 wss://nostr.kosmos.org\n\n## Markdown format\n\nYou can specify your metadata as YAML in a Front Matter header. Here's an\nexample file:\n\n```md\n---\ntitle: \"Good Morning\"\nsummary: \"It's a beautiful day\"\nimage: https://example.com/i/beautiful-day.jpg\ndate: 2025-04-24T15:00:00Z\ntags: gm, poetry\npublished: false\n---\n\nIn the blue sky just a few specks of gray \nIn the evening of a beautiful day \nThough last night it rained and more rain on the way \nAnd that more rain is needed 'twould be fair to say.\n\n— Francis Duggan\n```\n\nThe metadata keys are mostly self-explanatory. Note:\n\n* All keys except for `title` are optional\n* `date`, if present, will be set as the `published_at` date.\n* If `published` is set to `true`, it will publish a kind 30023 event,\n otherwise a kind 30024 (draft)\n* The `d` tag (widely used as URL slug for the article) will be the filename\n without the `.md` extension\n\n[1]: https://gitea.kosmos.org/raucao/gists/src/branch/master/1/markdown_to_nostr.sh\n[2]: https://github.com/nostr-protocol/nips/blob/master/23.md",
"sig": "712ebfdacc0985c6f93e5798f41d4bda0720f49c6b5681397c94e62ac82896f9f5d83d2eb30eadbd7d866a7c3e7f3929b45f1c7c8885c054debcd257ae14be5c"
}