claude-code-katex: Instructions file for Claude Code

CLAUDE.md

claude-code-katex CLAUDE.md is an instructions file for Claude Code from MahammadNuriyev62/claude-code-katex. It costs 4,712 tokens per session, scanned A, original, MIT.

Project instructions for a Claude Code extension that renders LaTeX maths with KaTeX inside Markdown. They describe the extension's architecture, user macros, and math-processing files.

In plain words
What is it for?
Use them when modifying the Claude Code webview patch, KaTeX or Markdown math handling, user macros, or related build files.
Why use it?
They give an agent the project context needed to change the extension without guessing where its code or processing pipeline lives.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; positional $N argument; mentions Claude Code.

This is MahammadNuriyev62/claude-code-katex's own configuration. It tells Claude Code how to work on claude-code-katex itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-code-katex configures →

Reuse

Borrowing it

Nothing to install: this file belongs to MahammadNuriyev62/claude-code-katex. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/MahammadNuriyev62/claude-code-katex/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/MahammadNuriyev62/claude-code-katex

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for claude-code-katex CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/mahammadnuriyev62/claude-code-katex/claude-md/github.svg)](https://agentmods.dev/instructions/mahammadnuriyev62/claude-code-katex/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/mahammadnuriyev62/claude-code-katex/claude-md"><img src="https://agentmods.dev/badge/instructions/mahammadnuriyev62/claude-code-katex/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for claude-code-katex CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/mahammadnuriyev62/claude-code-katex/claude-md"><img src="https://agentmods.dev/badge/instructions/mahammadnuriyev62/claude-code-katex/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,712 This file is loaded in full into every session.
When invoked 4,712 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.04712 $0.04712
Opus 5.5 $0.01885 $0.01885
Sonnet 5.5 $0.00942 $0.00942
Haiku 4.5 $0.00471 $0.00471

Measured yesterday against content hash 97bd7664e13d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

claude-code-katex CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 354 lines

How it starts

The opening of the file, as written. The whole thing — 354 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Claude Code LaTeX Extension

Architecture

This extension patches Claude Code's webview to render LaTeX math via KaTeX.

(Display name is "Claude Code LaTeX"; the extension ID and repo name are still claude-code-katex for marketplace continuity.)

The extension injects a math pipeline into Claude Code's own react-markdown plugin chain, so math is tokenized during Markdown parsing — verbatim — instead of being repaired in the DOM afterward.

  • applyPatch (in extension.js) locates the shared react-markdown processor with injectMathPlugins in markdown-patch.js. Acorn proves that plugin lists come from the same props parameter, enter one unified .use() chain in the correct order, and that exact processor parses and runs the Markdown. Injecting into the two .use() arguments covers every renderer, including callers with no plugin props. Getter reads stay unchanged; plugin arrays are copied with concat, and the original arguments remain when bundle loading fails. Multiple proven processors are rejected rather than guessed. On upstream builds with native math, the uniquely identified mathRenderingEnabled getter is guarded so only one pipeline owns the source. The full original getter body remains unchanged and runs whenever __KATEX_V2_LOADED is absent/false. This matters because native math tokenizers retain original-source offsets while our normalization can add line breaks. An unknown or ambiguous native gate rejects the entire patch. A fallback for older or isolated call shapes retains the existing output. Vendored Acorn parses JavaScript structure, accepting direct plugin props and helper-props spreads regardless of minified names, whitespace, comments, or property order. Helper definitions are resolved within their lexical scope; reassigned or shadowed helpers cannot establish an injection point. It adds rehypePlugins:[rehypeKatex] and remarkPlugins:[gfm, remarkBracketMath, remarkMath]. The injected references are guarded on window.__KATEX_V2_LOADED so a bundle-load failure cannot break Claude Code's Markdown. The spread form evaluates the original helper once and preserves its plugins and URL transform, including the Windows file-link plugin. Multiple candidate fallback call sites are rejected as unsupported. Structural rejection reasons are logged so compatibility failures can be diagnosed without guesswork.
  • The complete patched JavaScript must compile before any files change. All assets are read first, then backups, fonts, CSS, and JS are staged and replaced with per-file renames. Ordinary write failures roll back prior replacements; a process crash between renames is not an atomic transaction across files. Fresh upstream files replace stale backups. If only JS was replaced, the existing CSS backup must match before its old patch is replaced. Disable and uninstall never restore an old backup over an unpatched upstream file.
  • It prepends, in order, vendor/katex.min.js, the optional KaTeX contrib vendor/copy-tex.min.js (copying a selection of rendered math yields its LaTeX source), and vendor/remark-math-bundle.js to the webview bundle (Claude Code mounts its React app at the end of the bundle, so the globals must be defined first). A missing contrib file degrades gracefully — core math still renders. The contrib has a small local adaptation: its cloned selection drops hidden source blocks, hidden rendered equations and source-toggle buttons before serialization. Otherwise a selection across display math copies its hidden source too, duplicating the equation. Keep this adaptation when updating vendor/copy-tex.min.js.
  • If the injection point is not found — a future Claude Code reshaped its bundle — applyPatch returns false, touches nothing, and the extension shows an "update / report an issue" notice. There is no fallback renderer.
  • Display-math HAST nodes are wrapped after rehype-katex renders them with a source toggle and the application/x-tex annotation exposed as selectable $$-wrapped code (issue #18). One delegated click handler covers streamed equations; inline math is not decorated.

Read the full file on GitHub · 354 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday Changed · +36 lines · +441 tokens per session 97bd7664e13d
  2. 14d ago Changed · +9 lines · +129 tokens per session 4eeb5abf5e2a
  3. 17d ago Changed · +12 lines · +168 tokens per session c7bf21f0a554
  4. 18d ago Changed · +77 lines · +1,071 tokens per session dca9a4dac70e
  5. 1mo ago Changed · +1 tokens per session 82f04c63c4d8
  6. 1mo ago First seen · 220 lines · 2,902 tokens per session scan A ff9f37b3f32a

Subscribe to this mod's changes

claude-code-katex CLAUDE.md is an instructions file published in the GitHub repository MahammadNuriyev62/claude-code-katex (26 stars, last pushed 2d ago), licensed MIT. It adds 4,712 tokens to every session, about $0.0188 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories