JSPM

bbcode-to-ansi

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q71925F
  • License MIT

Parses bbcode to ansi.

Package Exports

  • bbcode-to-ansi
  • bbcode-to-ansi/bbcode-to-ansi.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bbcode-to-ansi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

bbcode-to-ansi

BBCode to ANSI parser. Created specifically for Godot external debuggers to support print_rich() terminal output. Project based on https://github.com/Calinou/godot-bbcode-to-ansi

Install

npm install bbcode-to-ansi

Usage

import BBCodeToAnsi from 'bbcode-to-ansi';
const bbcodeParser = new BBCodeToAnsi();

const bbcOutput = '[b][color=fuchsia]Colorful text output![/color][b]';
bbcodeParser.parse(bbcOutput);
// \u001b[1m\u001b[38;2;255;0;255mColorful text output\u001b[39m\u001b[22m
  • Supports hexidecimal coloring
  • Supports all 140 standard named colors with or without underscores in name

Limitations

  • Output terminal must support 24bit true color for all BBCode color options.
  • Only the following tags are supported b i u s indent code center right url color bgcolor fgcolor
  • center and right tags are emulated with spaces. May not be accurate depending on terminal size.