diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-06-04 00:29:27 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-06-04 00:29:27 +0200 |
| commit | a9c4f75f96eda90f0163b308d8c9b2f9ec895eb8 (patch) | |
| tree | 50da1a01ea776bfdc8d899f02a2a5bac7ca7c73a | |
| parent | 4056cc421d02e7b8df426551954814f15195afa9 (diff) | |
| download | sebastiano.tronto.net-a9c4f75f96eda90f0163b308d8c9b2f9ec895eb8.tar.gz sebastiano.tronto.net-a9c4f75f96eda90f0163b308d8c9b2f9ec895eb8.zip | |
Added blog post
| -rw-r--r-- | src/blog/2022-06-04-gemini/gemini.md | 190 | ||||
| -rw-r--r-- | src/blog/blog.md | 1 | ||||
| -rw-r--r-- | src/blog/feed.xml | 7 |
3 files changed, 198 insertions, 0 deletions
diff --git a/src/blog/2022-06-04-gemini/gemini.md b/src/blog/2022-06-04-gemini/gemini.md new file mode 100644 index 0000000..6d10112 --- /dev/null +++ b/src/blog/2022-06-04-gemini/gemini.md | |||
| @@ -0,0 +1,190 @@ | |||
| 1 | # The gemini protocol | ||
| 2 | |||
| 3 | My website is also available as a *gemini capsule* at | ||
| 4 | [gemini://tronto.net](gemini://tronto.net). | ||
| 5 | Can't open this link? Of course, you'll need a *gemini* browser for that! | ||
| 6 | |||
| 7 | [Gemini](https://gemini.circumlunar.space) is a very young (2019) internet | ||
| 8 | protocol similar to the mcuh more famous | ||
| 9 | [HTTP](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol), with | ||
| 10 | the design goal of being much simpler. | ||
| 11 | Gemini pages are written in *gemtext*, a very simple markup language that | ||
| 12 | offers headers, hyperlinks, lists and little more - notably, there is no | ||
| 13 | inline formatting. | ||
| 14 | |||
| 15 | **Disclaimer**: I am not a networking expert, so I will keep this article | ||
| 16 | at a very basic level. Nonetheless I may end up writing wrong or inaccurate | ||
| 17 | things. If you know this stuff better than me and you spot a mistake, feel | ||
| 18 | free to [send me an email](mailto:sebastiano@tronto.net). | ||
| 19 | |||
| 20 | ## Protocols: gemini:// and http:// | ||
| 21 | In the context of computer networks, a *protocol* is a set of rules that | ||
| 22 | describes how two different machines should communicate to exchange data. | ||
| 23 | If you are viewing this page in a normal web browser, the address in your | ||
| 24 | address bar probably starts with `http://` (or `https://`, but let's pretend | ||
| 25 | they are the same thing). This means that your device is communicating with | ||
| 26 | the server where I have uploaded this page using the *Hypertext Transfer | ||
| 27 | Protocol*. Concretely, your browser has sent the server a message such as | ||
| 28 | |||
| 29 | ``` | ||
| 30 | GET /blog/index.html HTTP/1.1 | ||
| 31 | Host: sebastiano.tronto.net | ||
| 32 | ``` | ||
| 33 | |||
| 34 | And the server has replied something like | ||
| 35 | |||
| 36 | ``` | ||
| 37 | HTTP/1.1 200 OK | ||
| 38 | Connection: keep-alive | ||
| 39 | Content-Length: 1131 | ||
| 40 | Content-Type: text/html | ||
| 41 | Date: Fri, 03 Jun 2022 14:34:22 GMT | ||
| 42 | Last-Modified: Sun, 29 May 2022 11:15:55 GMT | ||
| 43 | Server: OpenBSD httpd | ||
| 44 | |||
| 45 | <!doctype html> | ||
| 46 | <html lang="en"> | ||
| 47 | <head> | ||
| 48 | <title> Blog | Sebastiano Tronto </title> | ||
| 49 | |||
| 50 | (...Some more stuff...) | ||
| 51 | |||
| 52 | </html> | ||
| 53 | ``` | ||
| 54 | |||
| 55 | So there is some garbage that you don't care about (your browser does), | ||
| 56 | plus the actual content that you want to view. What exact garbage your | ||
| 57 | browser and the server should exchange before one ships actual content | ||
| 58 | to the other is exactly what the protocol defines. Calling it "garbage" | ||
| 59 | is a bit unfair, because there can be some useful information: for example, | ||
| 60 | when the page was last modified, so if your browser has already seen and | ||
| 61 | cached this page it does not need to download it again, but there could | ||
| 62 | be more stuff such as error messages or redirection paths. | ||
| 63 | |||
| 64 | In contrast, a gemini browser might send a request that looks like | ||
| 65 | |||
| 66 | ``` | ||
| 67 | gemini://tronto.net/blog/index.gmi | ||
| 68 | ``` | ||
| 69 | |||
| 70 | To which a gemini server would respond simply | ||
| 71 | |||
| 72 | ``` | ||
| 73 | 20 text/gemini; | ||
| 74 | # Blog | ||
| 75 | |||
| 76 | (...Some more stuff...) | ||
| 77 | ``` | ||
| 78 | |||
| 79 | Very briefly, this is how the two protocols work. You might be wondering how | ||
| 80 | exactly your browser is sending and receiving this information. Well, http | ||
| 81 | (and gemini) sit on top of other protocols which describe exactly this. These | ||
| 82 | other protocols in turn are on top of other protocols and... basically, | ||
| 83 | [it's protocols all the way down](https://en.wikipedia.org/wiki/Internet_protocol_suite). | ||
| 84 | |||
| 85 | (If you are curious where I got the server responses from: the UNIX command | ||
| 86 | `curl` and the gemini browser [`gmni`](https://git.sr.ht/~sircmpwn/gmni) | ||
| 87 | have a `-i` option that allows to see the messages received from the server.) | ||
| 88 | |||
| 89 | ## The gemtext markup language | ||
| 90 | |||
| 91 | Web pages are usually sent to your browser in | ||
| 92 | [HTML](https://en.wikipedia.org/wiki/HTML) format. There are plenty of | ||
| 93 | resources to learn how HTML works, so I will not explain it here. | ||
| 94 | Very briefly, | ||
| 95 | using tag pairs such as `<h1></h1>`, `<p></p>` or `<a href="..."></a>`, | ||
| 96 | an html file tells your browser how to display its content. It may | ||
| 97 | also embed images, videos or even executable scripts. | ||
| 98 | |||
| 99 | Gemtext plays the same role for gemini pages, but it has (by design) | ||
| 100 | a much more restricted feature set. It's syntax is somewhat similar to | ||
| 101 | [Markdown](https://en.wikipedia.org/wiki/Markdown), another markup language. | ||
| 102 | For example, headings and (unordered) lists work in the same way: | ||
| 103 | |||
| 104 | ``` | ||
| 105 | # A title | ||
| 106 | ## A second-level heading | ||
| 107 | There are only 3 levels of heading in gemtext | ||
| 108 | ### This is the last level | ||
| 109 | Lists: | ||
| 110 | * one | ||
| 111 | * two | ||
| 112 | * three | ||
| 113 | ``` | ||
| 114 | |||
| 115 | There is however a fundamental difference in how lines are parsed: in gemtext, | ||
| 116 | newlines in the code are preserved. This sounds completely normal for anyone | ||
| 117 | used to modern word processors, but it is different from how html, markdown | ||
| 118 | and Latex work, just to name a few. In practice, this means that in gemtext | ||
| 119 | you nhave to write your paragraphs as long lines, without inserting line breaks | ||
| 120 | unless you want the line to be broken at that specific point. | ||
| 121 | This may be annoying for people used to old-style line-based editors, such as | ||
| 122 | vi, but it makes parsing a gemtext file much simpler. | ||
| 123 | |||
| 124 | There are only three other things you can do in gemtext: links, block quotes | ||
| 125 | and preformatted text. | ||
| 126 | |||
| 127 | Links consist of a single line starting with `=>`, followed by a link and | ||
| 128 | (optionally) by the text you want to appear instead of the URL of the link. | ||
| 129 | |||
| 130 | ``` | ||
| 131 | => gemini://tronto.net A link to my homepage | ||
| 132 | ``` | ||
| 133 | |||
| 134 | Blockquotes are simply lines starting with `>`: | ||
| 135 | |||
| 136 | ``` | ||
| 137 | > This is a quote | ||
| 138 | ``` | ||
| 139 | |||
| 140 | Finally, preformatted text is any text between two lines consisting of three | ||
| 141 | backticks. It is going to appear as it is when rendered, i.e. your browser | ||
| 142 | won't parse any gemtext syntax inside preformatted text. | ||
| 143 | |||
| 144 | ```` | ||
| 145 | ``` | ||
| 146 | This is preformatted text | ||
| 147 | It can be useful to display ASCII art, like this | ||
| 148 | /\_/\ | ||
| 149 | ( o.o ) | ||
| 150 | > ^ < | ||
| 151 | => This line will not be interpreted as a link | ||
| 152 | ``` | ||
| 153 | ```` | ||
| 154 | |||
| 155 | And that's it, you now know gemtext. There is no inline formatting, no | ||
| 156 | embedded media, no CSS - your browser will take care of the styling and | ||
| 157 | if you want to view a picture you can just download it and open it with | ||
| 158 | an external app. | ||
| 159 | |||
| 160 | ## Gemini in practice | ||
| 161 | |||
| 162 | Gemini is basically a very stripped down version of the Internet. To me it | ||
| 163 | feels like some kind of very nice, underground web. Some *capsules* I like | ||
| 164 | browsing are [smol.pub](gemini://smol.pub) and | ||
| 165 | [midnight.pub](gemini://midnight.pub). I don't have an account there | ||
| 166 | yet, but I think I will make one at some point. I also check the | ||
| 167 | [Antenna feed aggregator](gemini://warmedal.se/~antenna) to discover new | ||
| 168 | stuff. | ||
| 169 | |||
| 170 | Basically, if you like the idea of a small and text-only version | ||
| 171 | of the internet, you should check out the gemini space. | ||
| 172 | The page [geminiquickst.art](https://geminiquickst.art) suggests some | ||
| 173 | browsers - I personally use gmnln, but it is more or less an interactive | ||
| 174 | curl, you probably won't like it. | ||
| 175 | |||
| 176 | ## Conclusions | ||
| 177 | |||
| 178 | I think gemini is an interesting exercise of minimalism, which I like. | ||
| 179 | I am not a networking expert, so I don't know what the pros and cons of using | ||
| 180 | gemini:// rather than http(s):// are, but I quite like gemtext as a markup | ||
| 181 | language. I am not too fond of using long lines, because as a terminal editor | ||
| 182 | user I am used to breaking up lines at 70-80 characters, but this is not | ||
| 183 | a deal-breaker. However, I still prefer making use of a few of the extra | ||
| 184 | features that html offers, such as inline formatting. | ||
| 185 | |||
| 186 | I will keep offering this website in gemtext via gemini://, but it will | ||
| 187 | stay html-first. This means that inline links will look a bit ugly in gemini | ||
| 188 | and, more annoyingly for the few gemini users, I am always going to use | ||
| 189 | http(s) links even when a gemini counterpart is available. | ||
| 190 | |||
diff --git a/src/blog/blog.md b/src/blog/blog.md index 34853b1..641b3a0 100644 --- a/src/blog/blog.md +++ b/src/blog/blog.md | |||
| @@ -2,5 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | [RSS Feed](feed.xml) | 3 | [RSS Feed](feed.xml) |
| 4 | 4 | ||
| 5 | * 2022-06-04 [The gemini protocol](2022-06-04-gemini) | ||
| 5 | * 2022-05-29 [The man page reading club: man(1)](2022-05-29-man) | 6 | * 2022-05-29 [The man page reading club: man(1)](2022-05-29-man) |
| 6 | * 2022-05-21 [Blogs](2022-05-21-blogs) | 7 | * 2022-05-21 [Blogs](2022-05-21-blogs) |
diff --git a/src/blog/feed.xml b/src/blog/feed.xml index 6693b07..f7db1ef 100644 --- a/src/blog/feed.xml +++ b/src/blog/feed.xml | |||
| @@ -9,6 +9,13 @@ Thoughts about software, computers and whatever I feel like sharing | |||
| 9 | </description> | 9 | </description> |
| 10 | 10 | ||
| 11 | <item> | 11 | <item> |
| 12 | <title>The gemini protocol</title> | ||
| 13 | <link>https://sebastiano.tronto.net/blog/2022-06-04-gemini</link> | ||
| 14 | <description>The gemini protocol</description> | ||
| 15 | <pubDate>2022-06-04</pubDate> | ||
| 16 | </item> | ||
| 17 | |||
| 18 | <item> | ||
| 12 | <title>The man page reading club: man(1)</title> | 19 | <title>The man page reading club: man(1)</title> |
| 13 | <link>https://sebastiano.tronto.net/blog/2022-05-29-man</link> | 20 | <link>https://sebastiano.tronto.net/blog/2022-05-29-man</link> |
| 14 | <description>The man page reading club: man(1)</description> | 21 | <description>The man page reading club: man(1)</description> |
