pg_markdown
Pre-release Markdown-to-HTML conversion extension for PostgreSQL.
pg_markdown · Pre-release Markdown-to-HTML conversion extension for PostgreSQL.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100252 | pg_markdown | pg_markdown | 0.1 | UTIL | PostgreSQL | C |
Usage
Sources:
pg_markdown adds a markdown data type and converts stored Markdown to HTML or plain text inside PostgreSQL. It can support small database-centered publishing workflows, but the reviewed code and documentation date from the project’s early 2011-era implementation and should be compatibility- and security-tested before use.
Core Workflow
Store Markdown as the extension type and render it only at the presentation boundary:
SQL Surface
markdownis the extension’s stored data type.to_html(markdown)returns rendered HTML astext.to_text(markdown)returns a plain-text representation astext.
Safety and Compatibility
- The upstream README promises Markdown conversion, not HTML sanitization. Treat
to_html(markdown)output as untrusted HTML and sanitize it for the target rendering context, especially when authors can submit raw HTML, links, or images. - Pin and test the accepted Markdown dialect. Modern Markdown variants, Unicode edge cases, malformed input, and renderer differences are not documented by this old release.
- Rendering during large scans consumes database CPU. Consider storing source Markdown as the system of record and caching sanitized output outside hot query paths.
- Before an upgrade, test type binary/text I/O, dump/restore, casts, and stored values on the exact PostgreSQL version; the official README does not claim support for current PostgreSQL releases.