Contents of this page:
Gemtext Highlighting For The Tilde Editor

👴 jdcard

Gemtext Highlighting For The Tilde Editor

The text editor I prefer (after spending so many years in the MS Windows environment) is Tilde.

It does not ship with a language file for Gemtext, so I put one together. The following two files should be placed in ~/.local/share/libt3highlight/:

The Gemtext language file: gemtext.lang.

format = 1

# Tilde highlighter definitions for Gemtext
# See gemini://gemini.circumlunar.space/docs/gemtext.gmi or
#      https://gemini.circumlunar.space/docs/gemtext.gmi for a description
# of the file format.

# Headings
%highlight {
  start = "^#"
  end = "$"
  style = "misc"
}
# Block-quote
%highlight {
  start = "^>"
  end = "$"
  style = "comment-keyword"
}
# List
%highlight {
  start = "^\* "
  end = "$"
  style = "keyword"
}
# Link line
%highlight {
  start = "^=>"
  end = "$"
  style = "variable"
}
# Preformatted text
%highlight {
  start = "^```"
  end = "^```"
  style = "comment"
}

The lang.map file, which associates the gemtext highlighter with *.gmi files.

format = 1

%lang {
  name = "Gemtext"
  file-regex = "\.gmi$"
  lang-file = "gemtext.lang"
}

That's all it takes. I have a couple of machines that won't run Tilde, so my fallback editor there is Micro. Its default syntax highlighting for Gemtext is acceptable, but could be fine-tuned by building a YAML file in ~/.config/micro/syntax.


©2022 🅭🅯🄏🄎 Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

Mastodon social.vivaldi.net Mastodon social.linux.pizza Mastodon qoto.org 🌐 jdcard.tilde.team

Search this site at marginalia.nu