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

Generated with cgit - Back to sebastiano.tronto.net