https://github.com/bombshell-dev/ansx
https://github.com/bombshell-dev/ansx
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bombshell-dev/ansx
- Owner: bombshell-dev
- License: mit
- Created: 2024-11-06T14:52:38.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-06T15:00:43.000Z (about 1 year ago)
- Last Synced: 2025-04-06T07:35:31.614Z (9 months ago)
- Language: TypeScript
- Size: 10.7 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `ansx` (ansi syntax)
ANSI Syntax is an EXPERIMENTAL markup language for ANSI escape sequences. Use it to render terminal apps!
- inspired by HTML (`class`, built-in elements)
- supports a subset of CSS (style)
- Built on top of JavaScript tagged template literals (no build step)
## Development
Run `pnpm start` to run the `./demo.ts` file.
## Example
```js
import { ansx } from "ansx";
function main() {
const name = 'user';
const output = ansx/* html */`
Greetings ${name}
🫡 It is your lucky day!
h1 {
color: green;
margin-left: 3;
}
.name {
color: black;
background: cyan;
padding-inline: 1;
}
p {
color: yellow;
}
`
console.log(output);
}
main();
```