TagScript Logo

TagScript

A simple and safe template engine.

Description

TagScript is a drop in easy to use string interpreter that lets you provide users with ways of customizing their profiles or chat rooms with interactive text.

Features

  • Written In Typescript
  • Offers CJS, ESM and UMD builds
  • Full TypeScript & JavaScript support
  • Blazingly Fast ⚡
  • Simple, expressive and safe template engine.
  • Supports many plugins.

Usage

All TagScript tags begins with a left curly brace {, and ends with a right curly brace }. Anything outside the curly braces is treated as plain text. Immediately after the left curly brace is the tag declaration/name. It can have multiple aliases. Following the tag name is a parameter it's optional for some tags. The parameter can start with parentheses or a dot. If it starts with parentheses, It'll end in parentheses. If it starts with a dot, It'll either stop before colon : or at the end of the tag. Following the parameter is the payload of the tag. It starts with a colon : and continues up to the end. It's optional for some tags.

Examples

# with parantheses
{declaration(parameters):payload}
# with dot
{declaration.parameters:payload}

If you want to escape a curly brace, colon, or parentheses then you can use backslash \ before the character.

{embed\.title.description:Hello world}

For Developers

	import { Interpreter, Interpreter, RandomParser, RangeParser, FiftyFiftyParser, IfStatementParser, SliceParser } from 'tagscript';
	const ts = new Interpreter(new SliceParser(), new FiftyFiftyParser(), new RandomParser(), new IfStatementParser());
	const result = await ts.run(`{random: Parbez,Rkn,Priyansh} attempts to pick the lock!, I pick {if({5050:.}!=):heads|tails}`);
	// Parbez attempts to pick the lock!, I pick heads

Buy me some doughnuts

If you want to support me by donating, you can do so by using any of the following methods. Thank you very much in advance!

Buy Me A CoffeeBuy Me a Coffee at ko-fi.com

Contributors ✨

Thanks goes to these wonderful people: