Establish and Maintain a Gemini Capsule with Emacs
Peter Prevos |
1079 words | 6 minutes
Share this content
This article introduces the Gemini internet protocol and shows how to access and create your own ‘capsules’ (the equivalent of a website) using Emacs. This plain text replacement for the bloated World Wide Web is a perfect companion for Emacs users.
Introduction
It has been suggested that the internet is dead. Bots dominate a significant share of web traffic, and companies lock users into algorithmic feeds to drive doomscrolling. And when you do finally find an interesting website, your eyeballs are attacked with advertising after every paragraph.
But there is still hope. Paraphrasing the words of punk legend Johnny Rotten, “The internet is not dead, it just smells funny”.
Cultural expression always finds new places as yet untouched by commercialisation. Several alternative web protocols are available. I am not talking about the dark web, where unspoken things happen, but about alternative protocols for exchanging information.
When people say "the internet," they really mean the World Wide Web (fun fact: "WWW" is the only abbreviation with more syllables than the full term).
The oldest of these is Gopher, which is a plain text protocol designed to exchange files through decentralised servers. The protocol was born at the University of Minnesota by a group of developers after a frustrating meeting. Gopher (named after the university mascot) is still around, and thousands of Gopher ‘holes’ as the vernacular goes, are still actively maintained. But Gopher is perhaps a bit too minimalist for the modern age.
Gemini (named after the Gemini space program) also supports an electronic library of interconnected text documents, with some improvements compared to Gopher but without the complexity of webpages. As Project Gemini put it:
Gemini isn’t about innovation or disruption; it’s about providing some respite for those who feel the internet has been disrupted enough already. We’re not out to change the world or destroy other technologies. We are out to build a lightweight online space where documents are just documents, in the interests of every reader’s privacy, attention and bandwidth.
Accessing Gemini Capsules in Emacs
In the Gemini protocol, what we know as a Gopher hole or a WWW site is called a capsule.
You can access Gemini capsules using the Elpher Emacs package, which renders both Gopher and Gemini pages. The package has a detailed manual, available through C-h R elpher <RET>. Elpher's navigation interface is inspired by the Emacs Info mode. Short form manual:
- Start with
M-x elpher(Use the universal argumentC-uto start additional Elpher sessions) g: Read a Gemini capsule (enter eithergopher://urlorgemini://url)= and =S-: Move between links<RET>: Follow a linku: Return to the previous pageA: Bookmark the current pageB: Open bookmarks?: for keybindings
Several customisation options are available, for example setting the default URL type to Gemini so that you don't have to type gemini:// for every capsule.
(use-package elpher
:custom
(elpher-default-url-type “gemini”))Finding Gemini Capsules
A good place to start exploring Gemini capsules is gemini://geminiquickst.art/. To get there use M-x elpher g geminiquickst.art <RET>.
Gemtext, the Gemini file format
Reading published Capsules is great fun, but what about publishing your own content? This section explains how to create a Gemini capsule in Emacs.
The files that make up a Gemini capsule have the .gmi or .gemini extension, also called the Gemtext format. The basic unit of the Gemini text format is a line, and the first 1 to 3 characters determine how it is rendered. Formatting is only permitted by line, so there is no inline bold text or emphasis and hyperlinks exist on separate lines, not embedded in a sentence. There is no CSS equivalent in Gemini; all rendering is undertaken client-side.
The basic syntax for a Gemtext file is:
- Heading: three levels, starting with
#,##, or### - Paragraph: starts with any non-prescribed character
- Quotation: start with
> - List item: start with
* - Link: starts with
=>followed by the URL and optional label - Monospace toggle: three backticks
```
The Gemtext format only allows text, so many capsules are adored with ASCII art. Some browsers allow inline images by linking directly to an image in the Gemini space. A relative link to a file recognised as an image file can be displaced by the Gemini browser by clicking on it. It goes against the minimalist philosophy of the Gemini philosophy to show all images by default.
This example Gemtext file demonstrates the available formats:
# Header 1
Each line is a paragraph. Gemini clients wrap the text as in Emacs visual-line-mode.
List example:
,* List item 1
,* List Item 2
## Header 2
> Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away (Antoine de Saint-Exupéry)
### Header 3
Gemtext format cheatsheet:
=> gemini://geminiprotocol.net/docs/cheatsheet.gmi
Toggle monospace to view ASCII art or source code:
```
_________
/___ ___\
//@@@\ /@@@\\
\\@@@/ \@@@//
\___ " ___/
jrjc | - |
\_/
```
Use a link as an embedded image (depending on browser):
=> image-filename.png Image headerWrite Gemtext in Emacs
You can write Gemtext in Emacs with the gemini-mode package. Support is currently incomplete, but it is certainly usable.
gemini-insert-link: Insert a Gemini Link (C-c C-l)gemini-insert-list-item: Start a new list item (C-c RET)gemini-insert-time-stamp: Insert a timestamp (C-c C-t) in accordance with thegemini-timestamp-formattemplategemini-open-link-at-point: Open a link in Elpher (C-c C-o)
I have remapped the insert list item function to C-c - for Org mode similarity.
(use-package gemini-mode
:bind (:map gemini-mode-map
(“C-c -” . gemini-insert-list-item)))The Gemini Server
You can create your own server with the Agate program by Matt Brubeck. This software provides a simple Gemini network protocol server built with Rust. All you need to run your own Gemini capsule is to run this program and open port 1965 on your server.
If you are unable to run your own servr then you can still participate by joining a Tilde community, names after the ~ symbol in front of user names. The Tildeverse is a constellation of Tilde server instances, which are public servers that allow public accounts.
To create a capsule, place at least a file named index.gmi or index.gemini in each directory in your server configuration.
Conclusion
The Gemini protocol is ideal for Emacs users because they both value the power of plain text.
Main disadvantage of Gemini is that the content is not discoverable through the usual means by which people find information. But the obscurity of Gemini is also it's strength.
Share this content