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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xaridar/rat

v2.0.0

Published

RAT templating language

Downloads

11

Readme

RAT

RAT is a simple HTML templating language for displaying simple pages with state in express.js.

Installation

via npm:

$ npm install @xaridar/rat

Syntax

RAT is a simple syntax for writing basic HTML. Here is an example of its features:

>This is a header
>>Up to 6 angle brackets can be used for smaller header elements

Plain text converts into a p tag in HTML.
Two consecutive blank lines represent a newline.


An image tag is represented as an image path between [image]
Videos are similar but between [[video]]

{
    Divisions in a page can be denoted using {content}, or |content| for centered divisions.
    By default, all included elements will be placed next to each other,
    but this can be changed
}
Links are placed between <link>. If there is no space between a preceding element and the link, it will be placed on the proceeding element;
Otherwise, the link reference will be displayed on the page.
For example:
<https://npmjs.com/package/@xaridar/rat>
vs
RAT<https://npmjs.com/package/@xaridar/rat>

>>>Lists
Lists can be created 2 ways:

Unordered lists can be denoted as a list of elements, each precedes by a single dash and space:
- element 1
- element 2

- this element starts a new list


Ordered lists are preceded by any number followed by a period, space, and element:
1. Ordered
2. second
1. numbers do not have to be unique or sequential

Variables

Variables passed in on compilation can be accessed between %s like: %variable%

If a requested variable is not passed, an error will occur

Array variables can be passed, and each element can be accessed in a loop.

For example:

!%names% *name* {
    1. A name is %name%
}

would compile to an ordered list of elements, with %name% replaced by each individual name in %names%.

Properties

RAT supports a couple properties at the top of the file. To specify a property, use

^ [property name]: [value]

Currently, the supported properties are:

  • theme for theme color
  • bg for background color

These two properties are to specify color only when using default styles. They accept any CSS-accepted color, including hsl, rgb, rgba, hexadecimal, or CSS color words.

  • css for custom CSS file

By default, styling is provided by a default CSS file. However, another CSS file can be specified and linked to.
Custom classes can also be added to divs in RAT by using the syntax

{.class-name
    content
}

This can then be styled using a CSS reference to .class-name in a custom file.

API

Here are the basic capabilities of the API:

const rat = require('@xaridar/rat');

// error callback
const err = console.error;

// variables
const options = {names: ['Bob', 'Sally']};

// get raw HTML output from file
const html = rat.renderRat('string of RAT', options, err);

When using express.js for file serving, RAT can be used directly as a template engine by placing .rat files in the views folder.

const rat = require('@xaridar/rat');
const express = require('express');

const app = express();

// enable RAT templating
rat.enableRat(app);
app.set('view engine', rat);

app.get('/', (req, res) => {
    res.render('index', {
        names: req.query.names
    });
})