@tiptap/extension-code-block-lowlight
code block extension for tiptap
This package has a good security score with no known vulnerabilities.
Community Reviews
Functional but requires careful XSS handling and dependency management
The main concern is that this extension renders user-generated code content, and while Tiptap's ProseMirror foundation provides some XSS protection through its schema validation, you're still dealing with arbitrary code snippets that could contain malicious patterns if not properly escaped. The library itself doesn't provide explicit sanitization guidance for code content, leaving that responsibility entirely to you. Additionally, you're pulling in the entire lowlight dependency chain (which includes highlight.js indirectly), adding supply chain surface area without much visibility into how those dependencies handle potentially malicious input patterns.
Error handling is minimal—if language registration fails or lowlight isn't configured correctly, you get silent failures or runtime errors that don't provide clear security context. The extension follows Tiptap's patterns but doesn't enforce secure-by-default configurations for content handling.
Best for: Projects with trusted content sources where you control the code snippets being rendered and can audit dependencies regularly.
Avoid if: You're handling untrusted user input without robust sanitization infrastructure or need strong supply chain guarantees.
Solid syntax highlighting for Tiptap, but requires manual lowlight setup
The main friction point is the initial setup—you need to manually import and register each language syntax you want to support, which isn't immediately obvious from the basic docs. The extension doesn't provide helpful runtime errors if lowlight isn't configured correctly; you just get unstyled code blocks. Once configured properly, it works reliably and the highlighted output integrates seamlessly with Tiptap's rendering.
Migration between versions has been mostly smooth, though breaking changes in major Tiptap releases require checking the changelog carefully. The extension respects Tiptap's command API patterns, so if you know Tiptap, this feels native.
Best for: Projects already using Tiptap that need syntax-highlighted code blocks with control over which languages to support.
Avoid if: You need a zero-config solution or want automatic language detection without manual registration.
Functional syntax highlighter with notable dependency and security concerns
However, from a security perspective, there are real concerns. The package brings in lowlight and highlight.js, which parse and process user-generated code content. While these don't execute code, the parsing itself has had CVE history. You're trusting the entire highlight.js supply chain, and there's no built-in sanitization layer. Input validation is essentially delegated to lowlight/highlight.js entirely. If you're handling untrusted user input in a multi-tenant environment, you need additional XSS protection beyond what this extension provides.
The extension itself is thin wrapper code with minimal error handling—parse failures from lowlight can bubble up unexpectedly. No security documentation exists for threat modeling or safe usage patterns. It follows Tiptap's general architecture but doesn't add security-focused defaults.
Best for: Internal tools or trusted content environments where users control their own code blocks and supply chain risk is acceptable.
Avoid if: You're building multi-tenant applications with untrusted user content or have strict security compliance requirements around dependency auditing.
Sign in to write a review
Sign In