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 🙏

© 2025 – Pkg Stats / Ryan Hefner

gitbook-plugin-term

v0.5.1

Published

Change code blocks to look more like a term

Readme

Term plugin for GitBook

This is the term plugin, based on the innovative terminal plugin by David Mogar. However, it is much cleaner and more intuitive to use, and works on all backends.

How can I use this plugin?

Add the following to your gitbook:

"plugins" : [ "term" ],

This will set up everything for you. If you want some more control over the behaviour or the style of your term, just add this section too:

"pluginsConfig": {
  "term": {
    "copyButtons": false,
    "fade": false,
    "style": "classic",
  }
}

The following are valid options for either for a block in block mode or the config file:

| Option | Default | Description | | ------------- | -------------- | ------------------------------------ | | fade | true | Fade non-input parts on hover | | copyButtons | true | Add the copy button | | style | "default" | Pick the style (based on term) | | prompt | regexp (below) | The string to search for and replace in block mode | | linestyles | true | Add per line styles (warning and error) |

Block based auto-colorization

The block based system using the GitBook block system and the keyword term. A named-group regular expression picks up the parts of your command line, and can be modified either in your defaults or per-block. This works in all backends, including the GitBook readme (json backend). When using this method, one copy button will be created that copies all commands.

The regular expression that is used by default is:

"(?<prompt>[^\\$^#^:]*)(?<pathsep>:?)(?<path>[^\\$^#]*?)(?<delimiter>[\\$#] )(?<command>.*)$"

The only requirement is that a named group "command" exist if you use copyButtons. The others are iterated in order and added as t-name spans. This default looks form something like prompt:path$ command (or #). You use it like this:

{% term lineStyles=true %}
foo@joe:~ $ ./myscript
Normal output line. Nothing special here...
But...
You can add some colors. What about a warning message?
[warning][WARNING] The color depends on the theme. Could look normal too
What about an error message?
[error][ERROR] This is not the error you are looking for

Language based method

You can also use a language based method, where you use triple-backticks followed by term as the language. This will work inside another block, but will not handle non-default color styles well, nor can you change the defaults.

Styles

Term has 6 styles:

  • default: Looks just like normal GitBook. Until you hover.
  • black: Just that good old black term everybody loves.
  • classic: Looking for green color font over a black background? This is for you.
  • flat: Oh, flat colors. I love flat colors. Everything looks modern with them.
  • ubuntu: Admit it or not, but Ubuntu have a good looking term.
  • white: Make your term to blend in with your GitBook.