commit 05628fa8b6a48df2ebe775951432818672d3b06e Author: Jason McBrayer Date: Wed May 20 14:57:24 2020 -0400 Initial version Currently doesn't support preformatted blocks; support for links is not as good as I want. diff --git a/README.gmi b/README.gmi new file mode 100644 index 0000000..32d575b --- /dev/null +++ b/README.gmi @@ -0,0 +1,19 @@ +# gemini-mode +## A simple syntax-highlighting mode for text/gemini + +### This is a sub-subheading + +#### This is a sub-sub-subheading + +##### We can go deeper. + +``` + ____ _ _ + / ___| ___ _ __ ___ (_)_ __ (_) +| | _ / _ \ '_ ` _ \| | '_ \| | +| |_| | __/ | | | | | | | | | | + \____|\___|_| |_| |_|_|_| |_|_| +``` + + +=> gemini://gus.guru/ GUS (Gemini Universal Search) diff --git a/gemini-mode.el b/gemini-mode.el new file mode 100644 index 0000000..11b66fc --- /dev/null +++ b/gemini-mode.el @@ -0,0 +1,59 @@ +;;; gemini.el --- A simple highlighting package for text/gemini + +;; Copyright (C) 2020 Jason McBrayer + +;; Author: Jason McBrayer +;; Created: 20 May 2020 +;; Version: 0.1.0 +;; Keywords: syntax gemini +;; Homepage: https://git.carcosa.net/jmcbray/gemini.el +;; Package-Requires: ((emacs "24")) + +;; This file is not part of GNU Emacs. + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU Affero General Public License as +;; published by the Free Software Foundation, either version 3 of the +;; License, or (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU Affero General Public License for more details. + +;; You should have received a copy of the GNU Affero General Public License +;; along with this program. If not, see . + + +(defface gemini-heading-face-1 + '((t :inherit bold :height 1.8)) + "Face for Gemini headings level 1") +(defface gemini-heading-face-2 + '((t :inherit bold :height 1.4)) + "Face for Gemini headings level 2") +(defface gemini-heading-face-3 + '((t :inherit bold :height 1.2)) + "Face for Gemini headings level 3") +(defface gemini-heading-face-rest + '((t :inherit bold)) + "Face for Gemini headings below level 3") + +(defvar gemini-highlights + (let* ((gemini-heading-3-regexp "^###\s.*$") + (gemini-heading-2-regexp "^##\s.*$") + (gemini-heading-1-regexp "^#\s.*$") + (gemini-heading-rest-regexp "^###+\s.*$") + (gemini-link-regexp "^=>.*$")) + `((,gemini-heading-rest-regexp . 'gemini-heading-face-rest) + (,gemini-heading-3-regexp . 'gemini-heading-face-3) + (,gemini-heading-2-regexp . 'gemini-heading-face-2) + (,gemini-heading-1-regexp . 'gemini-heading-face-1) + (,gemini-link-regexp . 'link))) + "Font lock keywords for gemini-mode") + + +(define-derived-mode gemini-mode text-mode "gemini" + "Major mode for editing text/gemini 'geminimap' documents" + (setq font-lock-defaults '(gemini-highlights))) + +(provide 'gemini-mode)