npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

book-n-quill

v1.0.0

Published

A library to convert BBCode-like strings to Minecraft JSON formatted text

Downloads

2

Readme

Formatting:

This is plain text.

This text is [b]bold[/b].

This text is [i]italic[/i], [s]strikethrough[/s].

This is [u]underlined[/u], this is [o]obfuscated[/o].

This [color=red]text[/color] is [color=#00aaee]colored[/color].

[font=minecraft:alt]This[/font] has different font.

Interactivity

[url=google.com]Open Google[/url]

[file=%appdata%/.minecraft/log/latest.log]Open the console log[/file]

[run=say hello @a[distance=..10] :D]Say hello to the neighbors![/run]
[suggest=say hi]Now you should say hi :D[/suggest]

[page=3]Go to page 3[/page]

[copy=ur cute <3]Just a simple copy, don't worry[/copy]

[text=This is shown on hover, it can do [b]this[/b]!]Boo![/text]

[item=minecraft:stick|count=4|tag={display:{Name:'"something idk"'}}]Show an item on hover[/item]

[entity=minecraft:skeleton|name=Boo!]Scary stuff![/entity]

[insert=I'm in your chat now]Hey, click this[/insert]

Content

[score=count|objective=temp/]

Look at yourself: [selector=@s/]

This is how you move forward: [key=key.forward/]

Let's peek inside the shulker box: [nbt=Items|block=~ ~ ~/]
and yourself: [nbt=Inventory|entity=@s/]
or your private storage: [nbt=items|storage=my:private/storage/]

[translate=This is not supported yet because I don't really know how translate works/]

Mixed

You [b]can [i]mix [selector=@s/][text=scary stuff]things[/text] just fine[/i][/b]

Custom tags

You can define custom tags like this:

class MyParser extends Parser {
    constructor() {
        super(
            // this one is the formatting + interactivity tags, the tags mustn't be self-closing
            {
                // it can only return formatting or interactivity
                golden: () => ({
                    color: 'gold'
                })
            },
            // this one is for content tags, these tags must be self-closing
            {
                myScore: ({ source, notMine }) => ({
                    score: {
                        name: source,
                        objective: `this_is_${notMine ? 'not' : ''}mine`
                    }
                }),
                // it can return any valid JSON text structure
                blackSelf: () => ({
                    selector: '@s',
                    color: 'black'
                })
            }
        )
    }
}

Then, parsing

[golden]Some golden [myScore|source=height|notMine/][/golden]

[blackSelf/]

with the new parser giving the same result as

[color=gold]Some golden [score=height|objective=this_is_notmine/][/color]
[color=black][selector=@s/][/color]

This is the compiled result of the texts above:

{"text":"This is plain text."}
["This text is ",{"bold":true,"text":"bold"},"."]
["This text is ",{"italic":true,"text":"italic"},", ",{"strikethrough":true,"text":"strikethrough"},"."]
["This is ",{"underlined":true,"text":"underlined"},", this is ",{"obfuscated":true,"text":"obfuscated"},"."]
["This ",{"color":"red","text":"text"}," is ",{"color":"#00aaee","text":"colored"},"."]
[{"font":"minecraft:alt","text":"This"}," has different font"]
{"clickEvent":{"action":"open_url","value":"google.com"},"text":"Open Google"}
{"clickEvent":{"action":"open_file","value":"%appdata%/.minecraft/log/latest.log"},"text":"Open the console log"}
{"clickEvent":{"action":"run_command","value":"say hello @a[distance=..10] :D"},"text":"Say hello to the neighbors!"}
{"clickEvent":{"action":"suggest_command","value":"say hi"},"text":"Now you should say hi :D"}
{"clickEvent":{"action":"change_page","value":"3"},"text":"Go to page 3"}
{"clickEvent":{"action":"copy_to_clipboard","value":"ur cute <3"},"text":"Just a simple copy, don't worry"}
{"hoverEvent":{"action":"show_text","contents":["This is shown on hover, it can do ",{"bold":true,"text":"this"},"!"]},"text":"Boo!"}
{"hoverEvent":{"action":"show_item","contents":{"id":"minecraft:stick","count":4,"tag":"{display:{Name:'\"something idk\"'}}"}},"text":"Show an 
item on hover"}
{"hoverEvent":{"action":"show_entity","contents":{"type":"minecraft:skeleton","name":"Boo!","id":"0000001c-000f-000a-0000-000000000bd7"}},"text":"Scary stuff!"}
{"insertion":"I'm in your chat now","text":"Hey, click this"}
{"score":{"name":"count","objective":"temp"}}
["Look at yourself: ",{"selector":"@s"}]
["This is how you move forward: ",{"keybind":"key.forward"}]
["Let's peek inside the shulker box: ",{"nbt":"Items","block":"~ ~ ~"}]
["and yourself: ",{"nbt":"Inventory","entity":"@s"}]
["or your private storage (/ must be escaped): ",{"nbt":"items","storage":"my:private/storage"}]
["You ",[{"bold":true,"text":""},"can ",[{"italic":true,"text":""},"mix ",{"selector":"@s"},{"hoverEvent":{"action":"show_text","contents":{"text":"scary stuff"}},"text":"things"}," just fine"]]]
[{"color":"golden","text":""},"Some golden ",{"score":{"name":"height","objective":"this_is_notmine"}}]
[{"bold":true,"text":""},"asd",{"selector":"@s","color":"black"}]