💾 Archived View for tilde.pink › ~kaction › log › 2021-06-23.1.gmi captured on 2024-05-26 at 15:20:06. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Gemini prescribes putting whole paragraphs in single line. I find it extremely unfortunate, since it places burden of textwrapping on client instead of server. Wrapping text is art, smashing whole paragraph into single line is one shell command. Unfortunately, I can do nothing but adapt, so I write my articles with semantic linefeeds, and post-process them during the build. Here is the command, using GNU sed:
$ sed -z -r -e 's/```/\x0/g' -e 's/([^`\n])\n([a-zA-Z])/\1 \2/g' -e 's/\x0/```/g'
Handling of verbatim blocks is left as excercise for the reader.
Update (2021-06-30): There is small program written in C that does exactly that, respecting verbatim blocks. Thanks to Sandra Snan for hint.