CodeMirror support for Ink

I recently published an NPM package with language support for Ink in the CodeMirror editor. If (like me) you have reason to be using CodeMirror rather than ACE as used in inky, this may be useful to you. It even has at least one scenario where it correctly highlights code when Inky doesn’t, but I’m not going to claim that the reverse may not be true as well!

The repository is here: GitHub - mavnn/codemirror-lang-ink: Ink language support for codemirror , and the npm package is at: https://www.npmjs.com/package/@mavnn/codemirror-lang-ink

7 Likes

I did something similar last year and I think it wasn’t complete and I’ve left it untouched since then so I will certainly look at your work, thank you for this.

2 Likes

Ah, cool! That’s both great but also (I have to admit) somewhat frustrating given I did try and search for existing attempts! I don’t know if I’m being less careful than I think, but I do really feel like search result quality has tanked in the last few years.

I’ll definitely be having a look at your repo as well, I’m sure there’s things in still missing.

Clearly flagging the way forward for using Twine as an Ink editor …

That sounds like the kind of statement that may or may not start a holy war…

2 Likes

Nice! I’ve been slowly working to update the Unofficial ink Cookbook (originally published in 2020) and put together a test editor that uses CodeMirror. I’m interested to use this work as a drop-in for the support I’d been trying to do.

3 Likes

Yeap, at the very least I spotted that I’d missed the mod operator and thread markers out of my grammar by checking yours. I’ve pushed a quick update.

2 Likes

Today I learned that you can split list definitions across multiple lines, which is a nice technique:

LIST qualities = // a list of qualities
  strong, 
  skilled, controlled, driven, fast, perceptive, honourable

Apropos of nothing, there’s a new release of the npm package out fixing a bug around parsing list definitions.

3 Likes