1# 🔗 neon.js - readable nostr23neon.js is a miniature nip19 plus a content renderer. It encodes and decodes `npub`, `note`, `nprofile`, `nevent` and `naddr`, and loaded alongside xenon.js it gives templates linked, escaped content and friendly fields. Relative times stay fresh on their own.45```html6<ol nxe-filter='{"kinds":[1]}'>7 <template>8 <li><a href="https://njump.me/{npub}">{npub}</a> <time nne-ago="{created_at}">{ago}</time><p>{content}</p></li>9 </template>10</ol>11```1213Each note shows its author's npub, a time like `5m` that keeps updating, and content with links, images and `nostr:` mentions.1415## Attributes1617| attribute | description |18|---|---|19| `nne-ago` | Unix time. Text becomes `now`, `5m`, `3h`, `2d` or a date, refreshed every 30s |2021`window.nneCfg = {link}` sets the prefix for `nostr:` links (default `https://njump.me/`).2223## Template fields2425| field | value |26|---|---|27| `{content}` | escaped content with links, images and `nostr:` mentions. npub mentions carry `nrn-profile` for radon.js |28| `{npub}`, `{note}`, `{nevent}` | encoded ids |29| `{naddr}` | for kinds 30000-39999 |30| `{ago}` | relative time at render |3132## API3334| function | returns |35|---|---|36| `neon.encode(type, data)` | bech32 string. `data` is hex for `npub`, `nsec`, `note`, or an object for `nprofile`, `nevent`, `naddr` |37| `neon.decode(str)` | `{type, data}`. Accepts a `nostr:` prefix |38| `neon.rich(text)` | escaped, linked HTML |39| `neon.ago(unix)` | short relative time |40| `neon.esc(text)` | escaped HTML |