💾 Archived View for tilde.pink › ~kaction › log › 2021-06-23.1.gmi captured on 2022-04-29 at 12:29:41. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

➡️ Next capture (2023-01-29)

-=-=-=-=-=-=-

Reformatting gemini text

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.

gemini://idiomdrottning.org/gmihw