💾 Archived View for sixohthree.com › log › publishing-to-the-gemlog-with-logseq.gmi captured on 2024-06-16 at 12:21:34. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-06-03)
-=-=-=-=-=-=-
I've recently started using logseq, "a privacy-first, open-source knowledge base that works on top of local plain-text Markdown and Org-mode files." Of course I'm curious what else I can use logseq for, so I'm live-testing publishing to my gemlog from within logseq.
I already have a workflow where my gemlog is automatically synched to a VPS using Resilio Sync, and a cron script rebuilds the atom feed every 5 minutes using gmisub2atom.
I can easily create a new page in logseq, so let's make a Gemlog page and create a child node, "Publishing to the Gemlog with logseq" (the page you're reading right now). We'll create some "properties," aka frontmatter, to this page for attributes like the post status (let's treat posts as "draft" unless they have an explicit "published" status) and post date.
logseq documentation: term/properties
As we write, we'll try to be gemtext-friendly, with no inline links or other text properties that don't translate 1:1 to gemtext. We still need to convert the Markdown to Gemtext. We can use CommonMark from the League of Extraordinary Packages to get an AST for a Markdown document, which is maybe overkill but I'm going to run with it.
League of Extraordinary Packages
Then we write some PHP to parse logseq's Gemlog index and get a list of articles, parse those articles and convert them into Gemtext, and write those articles back out to my capsule's Gemlog directory.
The above repository isn't quite done: I should really backfill my short list of Gemlog posts into logseq and then have the script regenerate the Gemlog index. Not bad for a first attempt though.
✑ Annika
📅 21 May 2022