Have ideas to improve npm?Join in the discussion! »

    tellraw2dom

    0.0.4 • Public • Published

    tellraw2dom

    Convert Minecraft's raw chat format to HTML DOM nodes for display in a web browser.

    Interactive demo

    Usage

    var tellraw2dom = require('tellraw2dom');
    
    var node = tellraw2dom('{"text": "hello ", "color": "aqua", "extra": [{"text": "world!", "bold": "true"}]}');
    document.body.appendChild(node);
    

    DOM nodes will be created appropriately to display 'hello world!' colored aqua.

    You can pass either a string to be parsed as JSON, or an object which has already been parsed. tellraw2dom optionally accepts a second argument to specify click, hover, and hoverOut callbacks to support the clickEvent and hoverEvent properties.

    Run npm start for a more sophisticated example or visit http://deathcap.github.io/tellraw2dom.

    Minecraft is property of Mojang Specifications

    See also

    License

    MIT

    Keywords

    none

    Install

    npm i tellraw2dom

    DownloadsWeekly Downloads

    2

    Version

    0.0.4

    License

    MIT

    Last publish

    Collaborators

    • avatar