Emacs `gql` template literals highlighting

Search for a command to run...

No comments yet. Be the first to comment.
Remember my post about switching to VSCode? Well, plot twist: the very next day after publishing it, I switched to WebStorm. And guess what? I've been on JetBrains IDEs ever since. I know, I know. Another "why I switched editors" post. But hear me ou...

I had been doing some basic interpreter work in Go and wanted to redo it in another language to solidify my understanding. Naturally, I chose Odin, it’s another great language, with a Go-like, easy-to-approach syntax and no unnecessary complexity. I ...

Why Emacs Keybindings? I've always preferred Emacs-style editing, especially the way it handles cursor movement and text manipulation. Even though I have switched to using VSCode for most of my development work, I often found myself missing the intui...

In my previous post about building C/C++ projects with CMake, I shared a simple CMakeLists.txt setup for compiling a basic project. Today, I’ll dive into a specific need that many developers encounter: linking libraries directly from project folders ...

Some time ago, I wrote a post about using Vim to look cool and why that’s not a good idea. Now, funny enough, here I am—having switched to VSCode after years of hopping between Vim and Emacs. This isn’t one of those "Vim sucks, I'm going back to VSCo...

This code is copied form emacs stack-exchange and adopted to work with web-mode for future reference.
Following is the link to the original stack exchange post:
step1: Install the packages
M-x package-install RET graphql-mode
M-x package-install RET mmm-mode
step2 : Put this in your config
;; Graphql
(require 'graphql-mode)
(require 'mmm-mode)
(mmm-add-classes
'((js-graphql
:submode graphql-mode
:face mmm-declaration-submode-face
:front "[^a-zA-Z]gql`" ;; regex to find the opening tag
:back "`"))) ;; regex to find the closing tag
;; mode in the next line can be any major mode that you use for the particular file
;; The original answer from stackexchanged had js-mode,
;; I have replaced it with web-mode is that's what I use
(mmm-add-mode-ext-class 'web-mode nil 'js-graphql)
(setq mmm-global-mode 'maybe)
;; Optional configuration that hides the background color for a highlighted block
;; I find it useful for debugging emacs, but when actually coding I dont want so much emphasis on submodes
(setq mmm-submode-decoration-level 0)