Supporting Fabricate's templates in Emacs
In its current state, Fabricate is best supported by the Emacs text editor. This is because of the very convenient package polymode
, which allows for context-sensitive definitions of major modes based on a syntax that uses regular expressions.
I welcome those knowledgeable enough about other editors to add support for Fabricate's syntax to add instructions via a Github issue.
The easiest way to set things up is via use-package. Here's how it works:
;; Homepage: https://fabricate.site
;;
;; This file is not part of GNU Emacs.
(use-package polymode
:config
(define-hostmode poly-fabricate-hostmode
:mode 'fundamental-mode)
(define-hostmode poly-fabricate-md-hostmode
:mode 'markdown-mode)
(define-innermode poly-fabricate-clojure-innermode
:mode 'clojure-mode
:head-matcher "\"?✳ *[-=]?"
:tail-matcher "🔚\"?"
:head-mode 'host
:tail-mode 'host)
(define-polymode poly-fabricate-mode
:hostmode 'poly-fabricate-hostmode
:innermodes '(poly-fabricate-clojure-innermode))
(define-polymode poly-fabricate-md-mode
:hostmode 'poly-fabricate-md-hostmode
:innermodes '(poly-fabricate-clojure-innermode)))
Adding this to your config will give you the mode poly-fabricate-mode
, which uses fundamental-mode
for basic text and clojure-mode
for Fabricate expressions. Fully compatible with Cider + REPL use; Fabricate exists in large part because I wanted a static website generator as responsive as my REPL. Now I have it, and you do too.