{"id":16217,"library":"showdown","title":"Showdown Markdown to HTML Converter","description":"Showdown is an open-source JavaScript library designed for converting Markdown formatted text into HTML. It is a robust, cross-platform solution, capable of operating both client-side in web browsers and server-side within Node.js environments. The current stable version is 2.1.0, with releases occurring periodically to address bugs, update dependencies, and introduce features; for instance, version 2.0.0 primarily focused on maintenance, updating its `yargs` dependency and Node.js support. Key differentiators include its foundational basis on John Gruber's original Markdown specifications, long-standing stability, and an experimental HTML to Markdown converter introduced in version 1.9.0, providing versatile bidirectional conversion capabilities. Unlike some newer, more opinionated Markdown parsers, Showdown offers extensive configuration options to control the conversion process, allowing users to enable or disable various Markdown features.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/showdownjs/showdown","tags":["javascript","markdown","converter"],"install":[{"cmd":"npm install showdown","lang":"bash","label":"npm"},{"cmd":"yarn add showdown","lang":"bash","label":"yarn"},{"cmd":"pnpm add showdown","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"For modern ESM environments (e.g., Node.js with type:module or bundlers), `Converter` is a named export. The default export might be undefined or an unexpected object in some setups.","wrong":"import showdown from 'showdown';","symbol":"Converter","correct":"import { Converter } from 'showdown';"},{"note":"In CommonJS (Node.js < 14, or CJS modules), `require('showdown')` returns an object containing the `Converter` class and other utilities. The `Converter` class is accessed as `showdown.Converter`.","wrong":"const { Converter } = require('showdown');","symbol":"showdown (CommonJS object)","correct":"const showdown = require('showdown');"},{"note":"When loaded directly in a browser via a `<script>` tag (e.g., from CDN), the `showdown` object is exposed globally on `window`, containing the `Converter` class.","wrong":"const converter = new Converter();","symbol":"Converter (Global in browser)","correct":"const converter = new showdown.Converter();"}],"quickstart":{"code":"const showdown = require('showdown');\n\nconst converter = new showdown.Converter({\n    emoji: true,\n    strikethrough: true,\n    tables: true,\n    tasklists: true,\n    openLinksInNewWindow: true\n});\n\nconst markdownText = `\n# Hello, Showdown!\n\nThis is a **Markdown** example with some common features.\n\n- List item 1\n- List item 2\n  - Sub-item\n\n~~Strikethrough text~~ and an :emoji:! 🎉\n\n| Header 1 | Header 2 |\n|---|---|\n| Cell 1 | Cell 2 |\n\n- [x] Task 1 (completed)\n- [ ] Task 2 (pending)\n\n[Visit ShowdownJS](https://showdownjs.com/)\n`;\n\nconst html = converter.makeHtml(markdownText);\n\nconsole.log(html);\n// Expected output: An HTML string representing the converted Markdown.\n","lang":"javascript","description":"This quickstart demonstrates how to initialize the Showdown converter with several common options (emoji, strikethrough, tables, tasklists) and convert a Markdown string into an HTML string using CommonJS syntax."},"warnings":[{"fix":"Update your CLI commands. For example, `showdown makehtml -i foo.md -o bar.html --strikethrough --emoji` becomes `showdown makehtml -i foo.md -o bar.html -c strikethrough -c emoji`.","message":"The command-line interface (CLI) for `showdown` changed how 'extra options' are passed. Instead of direct flags like `--strikethrough`, you must now use the `-c` flag for each option.","severity":"breaking","affected_versions":">=2.1.0"},{"fix":"Ensure your Node.js environment is running a version in the 'Current', 'Active', or 'Maintenance' phase (e.g., 12.x, 14.x, 16.x, 17.x at the time of the 2.0.0 release). Upgrade Node.js if necessary.","message":"Supported Node.js versions were updated to align with the official Node.js release schedule. This dropped support for older, unmaintained Node.js versions.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Review the new MIT license terms if your project's licensing or distribution depends on Showdown's license.","message":"The library's license changed from BSD to MIT with the 2.0.0 release. This primarily affects legal compliance and redistribution terms.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Test your CLI scripts and custom integrations thoroughly after upgrading to ensure no unexpected changes in argument parsing or behavior.","message":"The `yargs` dependency, used for CLI parsing, was updated to mitigate security vulnerabilities. While primarily an internal change, it could potentially introduce subtle behavioral differences or require adjustments if you relied on specific `yargs` behaviors in custom CLI scripts.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"For new projects, ensure you are testing against contemporary browser versions. If targeting extremely old browsers, be prepared for potential edge cases or feature limitations.","message":"While Showdown claims compatibility with very old browsers (e.g., IE6, Firefox 1.5), using it in such environments may not be practical or fully functional with modern Markdown features. Modern development typically targets more recent browser versions.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"In browsers, ensure you have included `<script src=\"path/to/showdown.min.js\"></script>` before attempting to use it. In a module, ensure it's imported via `require` or `import`.","cause":"The Showdown library was not properly loaded in the browser environment, or accessed incorrectly in a module context.","error":"ReferenceError: showdown is not defined"},{"fix":"Always use `new showdown.Converter()` to create a new converter instance.","cause":"Attempted to call `showdown.Converter()` as a function instead of instantiating it with `new`.","error":"TypeError: showdown.Converter is not a constructor"},{"fix":"For CLI options like `strikethrough` or `emoji`, use the `-c` flag for each option. E.g., `showdown makehtml -i input.md -o output.html -c strikethrough -c emoji`.","cause":"Using the pre-v2.1.0 CLI syntax for extra options after upgrading to Showdown 2.1.0 or newer.","error":"Error: Unknown option: --strikethrough (or other CLI options)"},{"fix":"Refactor your import statements to use ESM syntax: `import { Converter } from 'showdown';` and then `new Converter();`.","cause":"Attempting to use CommonJS `require()` in an ECMAScript Module (ESM) context (e.g., a Node.js file with `\"type\": \"module\"` in `package.json`).","error":"ReferenceError: require is not defined"}],"ecosystem":"npm"}