{"id":25843,"library":"kramed","title":"kramed","description":"A markdown parser and compiler forked from marked, designed to be kramdown-compatible and support MathJax. The current stable version is 0.5.6, with no active development since 2016. It offers synchronous and asynchronous rendering, customizable renderers, and built-in highlighting integration. Unlike marked, kramed aims to align with the kramdown standard (common in Jekyll) and provides enhanced math support, making it suitable for documentation tools like GitBook. However, it is now largely superseded by modern markdown parsers such as marked (post-0.6) and markdown-it.","status":"abandoned","version":"0.5.6","language":"javascript","source_language":"en","source_url":"git://github.com/GitbookIO/kramed","tags":["javascript","markdown","markup","html","kramdown","kramed","parser"],"install":[{"cmd":"npm install kramed","lang":"bash","label":"npm"},{"cmd":"yarn add kramed","lang":"bash","label":"yarn"},{"cmd":"pnpm add kramed","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Optional peer dep for async code highlighting example.","package":"pygmentize-bundled","optional":true},{"reason":"Optional peer dep for synchronous code highlighting example.","package":"highlight.js","optional":true}],"imports":[{"note":"kramed is a default export; named import will fail. CJS require works but ESM is preferable.","wrong":"import { kramed } from 'kramed';","symbol":"kramed","correct":"import kramed from 'kramed'; // or const kramed = require('kramed')"},{"note":"Renderer is a named export, not default. Do not confuse with kramed.Renderer property.","wrong":"import Renderer from 'kramed';","symbol":"Renderer","correct":"import { Renderer } from 'kramed';"},{"note":"These named exports exist but are rarely used directly; kramed() calls them internally.","wrong":null,"symbol":"Lexer / Parser","correct":"import { Lexer, Parser } from 'kramed';"}],"quickstart":{"code":"import kramed from 'kramed';\n\nconst options = {\n  gfm: true,\n  tables: true,\n  breaks: false,\n  pedantic: false,\n  sanitize: true,\n  smartLists: true,\n  smartypants: false\n};\n\nconst markdownString = '# Hello World\\n\\nThis is **bold** and `code`.';\nconst html = kramed(markdownString, options);\nconsole.log(html);\n// Output: <h1 id=\"hello-world\">Hello World</h1>\\n<p>This is <strong>bold</strong> and <code>code</code>.</p>\\n","lang":"typescript","description":"Parses a simple markdown string into HTML using kramed with common options. Uses ES module import."},"warnings":[{"fix":"Call setOptions before rendering, or pass options directly to kramed() instead.","message":"kramed.setOptions does not return the kramed function, but sets global state.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Migrate to a maintained alternative like marked, markdown-it, or unified/remark.","message":"The package is no longer maintained; last release in 2016. Unpatched vulnerabilities may exist.","severity":"deprecated","affected_versions":"all"},{"fix":"Set sanitize: false if you want to allow raw HTML, but be aware of XSS risks.","message":"sanitize option defaults to true, which strips HTML tags from output. This may break intended inline HTML.","severity":"gotcha","affected_versions":">=0.5.0"},{"fix":"Use the high-level kramed() function instead of calling lexer/parser directly.","message":"kramed.lexer and kramed.parser are not documented and their API may change without notice.","severity":"gotcha","affected_versions":"all"},{"fix":"Do not pass a callback unless you have set an async highlight function; otherwise use synchronous return.","message":"Async callback style (kramed(str, callback)) is only valid when options.highlight uses async highlighting.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Extend the Renderer class to handle math tokens, or use a dedicated math plugin.","message":"MathJax support requires custom renderer; not built-in despite documentation claims.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'import kramed from 'kramed';' or 'const kramed = require('kramed');'","cause":"Using ESM import with wrong syntax (e.g., import { kramed } from 'kramed') instead of default import.","error":"ReferenceError: kramed is not defined"},{"fix":"Ensure your bundler config uses esModuleInterop or use require().","cause":"Rarely, bundlers may mangle the default export if mixing CJS/ESM.","error":"TypeError: kramed is not a function"},{"fix":"Check that the argument to kramed() is a string, not a buffer or HTML.","cause":"Nowadays with bundlers, if you import kramed and try to call a method on the result, but kramed returns a string; this error usually occurs when you accidentally call kramed on an object.","error":"kramed(...).trim is not a function"},{"fix":"Run 'npm install kramed' and verify package.json has 'kramed' in dependencies.","cause":"Not installed or typo in package name (e.g., 'kramed' vs 'kraemde').","error":"Cannot find module 'kramed'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}