ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Spintax

by investblog ST3 New

Engine-accurate spintax syntax highlighting for Sublime Text — {a|b} enumerations, [a|b] permutations, %vars%, conditionals, plurals. Install via Package Control.

Details

Installs

  • Total 1
  • Win 1
  • Mac 0
  • Linux 0
Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7
Windows 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Spintax — Sublime Text syntax highlighting

CI License: MIT

Syntax highlighting for spintax templates in Sublime Text — engine-accurate against the Modern Spintax Engine (@spintax/core) contract. Applies to .spintax files.

  • Enumeration{a|b|c}, empty option allowed: {|a|b}
  • Permutation[a|b|c], with config [<minsize=2;maxsize=3;sep=", ">a|b|c]
  • Variable%name%
  • Local set#set %name% = value — macro, re-rolled at every reference
  • Local def#def %name% = value — resolved once per render, held everywhere
  • Include#include "slug-or-id"
  • Conditional{?VAR?then|else}, {?!VAR?…}
  • Plural{plural %n%: one|few|many}
  • Comment/# … #/

Example

/# hero block #/
#set %product% = Acme
#def %tone% = {friendly|warm}
{Welcome to|Meet} %product% — %tagline%, trusted since {2019|2020}.
Ships with [<minsize=2;maxsize=3;sep=", ";lastsep=" and ">SSO|audit logs|alerts]{?free? — free tier available|}.
You have %n% {plural %n%: message|messages}.

Install

Package Control (recommended)

  1. Open the Command Palette → Package Control: Install Package.
  2. Search for Spintax and install.

Manual

Clone or download this repo into your Sublime Text Packages/ directory (Preferences → Browse Packages…) as a folder named Spintax.

What you get

  • Full, engine-accurate tokenization of every spintax construct, including nested spintax inside conditional branches and enumerations.
  • Correct permutation config vs HTML: <minsize=…;sep=…> is config, while HTML inside items ([<li>a</li>|b], [<a href="/x">…</a>|b]) stays content; genuine separators like [<and>a|b] and per-element [a<, >|b] are highlighted.
  • Strict conditional / plural openers — {??x} and {plural noun} are not mis-highlighted.
  • Toggle Comment (Ctrl/Cmd+/) wraps selections in /# … #/.

Development

Tokenization is verified with Sublime Text's own syntax test runner. The assertions live in tests/syntax_test_spintax.spintax and cover every construct plus the tricky discriminators (permutation config vs. HTML, leading/trailing separators, strict conditional/plural openers). CI runs them against Sublime Text latest, stable, and an ST3 build via SublimeText/syntax-test-action.

Run them locally from Sublime Text with Build With: Syntax Tests (Ctrl/Cmd+B) while the test file is open.

Releases are published from tags: tag a commit X.Y.Z and push it, and the release workflow creates the GitHub Release using the matching ## X.Y.Z section of CHANGELOG.md as its notes — so that section has to exist first. Package Control installs from tags, so a tag is the release; the GitHub Release entry is the shop window.

The VS Code sibling additionally verifies the mirrored TextMate grammar headlessly (vscode-tmgrammar-test) under the real Oniguruma engine.

Related

License

MIT — part of the 301.st toolset.