Getting StartedInstall
npm install rettangoli-ansi-json
Render your first document
import { render } from 'rettangoli-ansi-json';
const doc = {
content: [
'Hello ',
{ text: 'Rettangoli', style: { fg: 'green', bold: true } },
'!\n'
]
};
process.stdout.write(render(doc));
Basic shape
{
styles: {
warning: { fg: 'yellow', bold: true }
},
content: [
"plain text",
{ text: "styled text", style: "warning" },
{
style: { underline: true },
children: ["nested span content"]
},
{ ctrl: "cursor", to: { row: 1, col: 1 } }
]
}
Useful links