Formatting Gemtext for Gopher - further tweaks ♊
Formatting Gemtext for Gopher ♊
I thought some more about this since my original posting and a few things began to bother me.
- Double space indentation to URLs and preformatted text [§ Preformatted]
- Descriptions for links could extend beyond the defined line length
- The ambiguity of quote display [§ Quotes]
- [✍ 14:31] Headings could extend beyond the defined line length
So I have tweaked the script and 'rectified' these, as follows.
- URLs and preformatted text no longer have any indentation, so that line length is reduced and entire lines can be copy and pasted (without extraneous spaces).
- I leave the '```' at the start and end of preformatted sections in place, so that it is clear that they are seperate from regular text, without the need for such indentation.
- Link descriptions are now hard wrapped as well (the URLs themselves remain unwrapped—to avoid breakage) and also end with ' ~' to better stand out.
- URLs are no longer filtered through (sed) character replacement (which could have broken them).
- Quote lines start with '> ' on every (wrapped) new line, which is a widely understood concept from mail clients, Gemtext, Markdown, etc.
- [✍ 14:31] Added support for wrapping headings that are longer than the line length—only URLs and preformated text can now extend beyond the hard wrap boundary.
- [✍ 15:13] Dropped the default line length to 70 based on comments I saw in solderpunk's 'text wrapping experiment', where he noted that this will display correctly on mobile (Pocket Gopher), at least in landscape mode.
I am a little sad about the quotes, as I thought my previously suggested display was nicer looking but styling is less important than understanding.
Sample Gemtext file - initial reformat
Sample Gemtext file - updated reformat
Shell script filter to reformat .gmi files
text wrapping experiment - solderpunk [✍ 15:13]
⁂
Update [✍ 2022-01-11]
After seeing Szczeżuja's use of an older version of my script on his new Gopher hole, I realised that I am not willing to let go of my "fancy quoting" just yet. I really think it looks great when looking at his "Gopher novice" articles.
So… I have added "fancy quoting" back. 🎉
I also removed the '```' before and after preformatted text.
- This avoids it potentially being confused with the styled quotes
- After looking at more of my converted posts I realised it just isn't needed. It "just works" and makes sense without, since everything is preformatted in Gopher.
The only difference between regular text and code-like text (```) now is that for the latter, line length is not limited and it is not filtered to remove any characters.
Sample Gemtext file - (further) updated reformat
⁂
/gemlog/