💾 Archived View for jdcard.com › gemtext-highlighter-for-tilde.gmi captured on 2023-01-29 at 02:17:38. Gemini links have been rewritten to link to archived content

View Raw

More Information

➡️ Next capture (2024-05-26)

-=-=-=-=-=-=-

👴 jdcard

Gemtext Highlighting For The Tilde Editor

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

The Tilde Text Editor

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.

micro - a modern and intuitive terminal-based text editor

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

🗡️ spartan://jdcard.com:3300/

🛰️ gemini://jdcard.com/

🌐 http://jdcard.com/