Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 16, 2026·3 min de lectura

Showdown — Bidirectional Markdown to HTML Converter in JavaScript

Showdown is a JavaScript library that converts Markdown to HTML and back, running in both the browser and Node.js with extensive extension support for custom syntax.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Showdown
Comando CLI universal
npx tokrepo install 4b972e9d-5166-11f1-9bc6-00163e2b0d79

Introduction

Showdown is one of the original JavaScript Markdown parsers, providing reliable bidirectional conversion between Markdown and HTML. It works identically in Node.js and browsers, making it suitable for both server-side rendering and client-side preview editors where you need to parse or generate Markdown on the fly.

What Showdown Does

  • Converts Markdown text to HTML with configurable flavor options
  • Converts HTML back to Markdown (reverse conversion)
  • Supports GitHub Flavored Markdown (tables, strikethrough, task lists)
  • Provides an extension system for adding custom syntax rules
  • Runs in any JavaScript environment without dependencies

Architecture Overview

Showdown processes Markdown in multiple passes: first normalizing input (tabs, line endings), then applying block-level grammar rules (headings, lists, blockquotes, code blocks), and finally inline-level rules (bold, italic, links, images). Each rule is a regex-based sub-parser that can be replaced or extended via the plugin system. The output is assembled as an HTML string without an intermediate AST.

Self-Hosting & Configuration

  • Install as an npm package or include the CDN script for browser use
  • Configure options globally via showdown.setOption() or per-converter instance
  • Enable GFM features with tables: true, strikethrough: true, tasklists: true
  • Set sanitize: true or use a separate sanitizer to prevent XSS in user content
  • Register custom extensions with showdown.extension('name', extensionFunction)

Key Features

  • Bidirectional conversion (Markdown to HTML and HTML to Markdown)
  • Works identically in Node.js and browser environments
  • Extensive option flags for GFM, metadata, emoji, and more
  • Plugin architecture for custom syntax extensions
  • Zero external dependencies and small bundle size (~40KB minified)

Comparison with Similar Tools

  • marked — marked is faster for one-way Markdown-to-HTML but lacks reverse conversion
  • markdown-it — markdown-it is plugin-rich and CommonMark-compliant; Showdown offers simpler bidirectional support
  • remark — remark uses an AST pipeline for transformations; Showdown is regex-based and simpler to configure
  • unified — unified is a full content processing ecosystem; Showdown is a focused single-purpose converter
  • Turndown — Turndown handles HTML-to-Markdown only; Showdown does both directions in one library

FAQ

Q: Is Showdown CommonMark compliant? A: Showdown follows the original Markdown spec with GFM extensions. It does not strictly follow CommonMark but handles most practical use cases correctly.

Q: Can I use Showdown for user-generated content safely? A: You should pair Showdown with a sanitizer like DOMPurify. Showdown's built-in sanitize option is basic and not recommended for untrusted input.

Q: How do I add custom syntax like :emoji: codes? A: Write a Showdown extension that defines regex patterns and replacements, then register it before creating the converter.

Q: Does Showdown support syntax highlighting in code blocks? A: Showdown renders code blocks as <pre><code> elements. Pair it with Highlight.js or Prism.js for syntax coloring.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados