While doing the Tact Tour, for storing code for each lesson I've settled on strings specified using template literals of JS/TS.
The basic setup needs the following definition:
/** Template literal for highlighting Tact code within strings */
export const tact = (strings: TemplateStringsArray, ...values: unknown[]): string => {
return strings.reduce((result, string, i) => {
return result + string + (values[i] || "");
}, "");
};
After which, one can write tact followed by backticks, and then in code editors that use Tree-sitter grammars, those strings would automatically highlight with tree-sitter-tact. I can't vouch for all such editors, but in Neovim and Helix, the inner code there is highlighted as Tact code, while the outer code is highlighted as TypeScript:
import { tact } from "./tact-literal"; // example import
const tactCode = tact`// here goes code in Tact, with highlighting!
import "@stdlib/ownable";
// ...
contract Whatever() {}
Or, an actual example from the editor:

It could be fun to enable some code intelligence and at least some auto-complete and hover while the cursor (caret) is within the Tact template literal in the .[tj]sx? files (basic regex for js, jsx, ts, tsx).
Not necessary, as in case of the Tour all examples would be checked locally for validity upon compilation. But fun!