Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
7
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a monorepo containing two related security-focused npm packages for hardening markdown against data exfiltration attacks through LLM prompt injection:
react-markdown that filters URLs with configurable allow-listsharden-react-markdown/: React wrapper for secure markdown renderingmarkdown-to-markdown-sanitizer/: Standalone markdown sanitizer with comprehensive security testingBoth packages use pnpm (not npm) as the package manager.
# Run tests for both packages pnpm test # Run tests for specific package pnpm run test:harden-react-markdown pnpm run test:markdown-to-markdown-sanitizer
cd harden-react-markdown # Build the package pnpm run build # Run tests pnpm test # Run tests in watch mode pnpm run test:watch # Run tests with UI pnpm run test:ui # Prepare for publishing (build + test) pnpm run prepublishOnly
cd markdown-to-markdown-sanitizer # Build the package pnpm run build # Run all tests pnpm test # Run tests in watch mode pnpm run test:watch # Run tests with UI pnpm run test:ui # Run tests with coverage pnpm run test:coverage # Type checking pnpm run check-types pnpm run check-types:tests pnpm run check-types:all # Linting pnpm run lint pnpm run lint:tests # Run single test file pnpm test -- tests/basic-sanitization.test.ts
react-markdown with URL filteringMarkdownSanitizer: Main orchestration classUrlNormalizer: URL validation and prefix matchingHtmlSanitizer: DOMPurify wrapper with GitHub-compatible rulesBoth packages share the tests based on markdown-to-markdown-sanitizer/tests/bypass-attempts/*.md. Adding more examples hardens both packages
tests/bypass-attempts/Both packages are designed for defensive security use only:
#, removes invalid src attributesuser-content-