← Catalog

pi-nerdfont-unescape

Observable Nerd Font icon output for the Pi TUI: an ASCII escape protocol, code-span protection, visible substitution for undrawable codepoints, input escaping, stream drop detection, glyph lookup and layout tools

Extension

Install

Install with PiG

pig install npm:pi-nerdfont-unescape

Install with Pi

pi install npm:pi-nerdfont-unescape
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./nerdfont-unescape.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.3.2 (README.md). PiG does not review it.

English · 简体中文

pi-nerdfont-unescape

Keeps Nerd Font icons in pi's replies.

Nerd Font icons are Unicode private-use characters, and a model's output stream silently swallows them: you ask for a Python icon, and the place where it should be comes back empty — no error, no warning. This extension gets the model to write icons as ordinary text (\uE235) instead, and turns them back into icons when the reply arrives.

Limits

It does not eliminate silent loss. It blocks most of it and makes the rest visible.

It doesIt cannot
The model writes \uE235 → the icon survives and rendersThe model writes a raw character and the stream deletes it before the message arrives — nothing is left to check
Characters that cannot be drawn show as □U+XXXXIf your terminal renders with a font the extension could not read, you can still get tofu — it trusts the fonts it can read
Drops the extension itself sees (in the stream, missing from the final message) are reported with codepointsA drop earlier than that leaves no signal
Code blocks are left untouched—
Your own message is escaped before it is sent—

In one line: it fixes the loss it can see and says what it cannot see. The model's output stream is not something it can repair.

Three more:

  • [[nf:name]] is beta — names resolve only against installed fonts.
  • Four-space indented blocks are not treated as code; they cannot be told apart from list continuations, and a wrong guess would silently break restoration elsewhere.
  • The transcript stores the restored characters (that is what you saw). If the model later copies one instead of writing the escape, it can still be dropped.

Install

pi install npm:pi-nerdfont-unescape

Restart pi. On Linux with fontconfig that is all it takes.

Glyph lookup and layout rendering additionally want python3 with fontTools (pip install fonttools). Without them the extension still works and names the lookups it could not run.

No runtime dependencies — typebox is declared as a peer because pi provides it.

What changes for you

(blank)(blank)
Icons by namewrite [[nf:python]]; it becomes a real icon when the reply lands (beta: installed fonts only)
Icons you pasteescaped before sending, so the model receives what you typed instead of a blank
Config snippets you copyescapes inside code blocks and inline code are left exactly as written
Missing iconscharacters that cannot be drawn show as □U+E5EE instead of a blank

Usage

You wantSay something like
An icon in a list or heading“use [[nf:python]] for the Python item”
The right codepoint for a glyph“look up the docker icon”, “what is U+E0A0?” → nerdfont_lookup
An aligned table, status bar or poster“render this as a boxed table” → render_preview
Starship's default symbol for a module“starship nodejs symbol” → nerdfont_lookup

nerdfont_lookup reads the fonts actually installed on your machine, so its results match what your terminal can draw. render_preview does width arithmetic instead: CJK and emoji count as two columns, private-use characters as one. Neither guesses a codepoint.

Troubleshooting

You seeWhyWhat to do
□U+E5EE in a messagethat codepoint has no glyph in your terminal's font chain, or the chain could not be identifiedinstall a Nerd Font and set it as the terminal font; the marker names the exact codepoint
The icon is gone entirelythe model wrote the raw character and the stream deleted it before anything could see itask for the escape form (\uE235) or the [[nf:name]] marker
could not be resolved — font lookup unavailablepython3 or fontTools is missingpip install fonttools, or ignore it — everything else still works
\uE235 visible inside a fenced blockintended: code stays literal so it can be copiednothing to fix

Settings

VariableDefaultWhen you need it
PI_NF_FONT_PATHSfontconfig's monospace chainmacOS, Windows, or a terminal font that is not fontconfig's monospace: point at the font files or directories (platform path separator)
PI_NF_CMAP_CACHE~/.cache/pi-nerdfont-unescape/cmap.jsonto move the glyph cache; safe to delete, rebuilt next session
PI_RENDER_ALLOW_ANYunsetlets render_preview write outside the working directory and /tmp

Development

Tests, the mutation audit and the model-free TUI probes are covered in DEVELOPMENT.md.

License

MIT. Keep the copyright and license notice when you use it.

The nerdfont_lookup tool embeds the default symbol table from starship (starship print-config --default, ISC license): only the module names and their codepoints, no starship code.