Registry / database / postgres-markdown

postgres-markdown

JSON →
library1.3.6jsnpmunverified

A CLI tool (1.3.6) that generates Slate-compatible Markdown documentation from a PostgreSQL database schema. It connects to a Postgres instance, inspects tables, columns, types, constraints, and comments, and produces a single Markdown file suitable for tools like Shins or Slate. Offers options for host, port, database, output file, locale, and object ignore patterns. Differentiated by its direct extraction from live database metadata and support for inherited tables and custom types.

npm install postgres-markdown
INSTALL
IMPORT
SIG · POSTGRES-MARKDOWN
P
postgres-markdown
databasejavascriptv1.3.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import postgresMarkdown from 'postgres-markdown'
const postgresMarkdown = require('postgres-markdown')
ESM-only since v1.3.0; default export is a function.
exec
import { exec } from 'child_process'
const exec = require('child_process').exec
Use exec() to run the CLI programmatically.
types
import type { DatabaseConfig } from 'postgres-markdown'
TypeScript types available, not exported in older versions.

This shows how to programmatically run postgres-markdown as a CLI from Node.js, passing database credentials via environment variables.

import { exec } from 'child_process'; const outputPath = './docs.md'; const command = `postgres-markdown -H localhost -p 5432 -u postgres -W ${process.env.PGPASSWORD ?? ''} -d mydb -o ${outputPath}`; exec(command, (error, stdout, stderr) => { if (error) { console.error(`Error: ${error.message}`); return; } if (stderr) { console.error(`stderr: ${stderr}`); } console.log(`Documentation generated at ${outputPath}`); });
Debug
Known issues
gotchaPassword is passed as a command-line argument, which may be visible in process lists on Unix systems.
fix
Use environment variable PGPASSWORD and pass via -W with value from process.env; consider using pgpass file instead.
affects: >=1.0.0
gotchaDefault locale is 'ru', which produces Russian comments in output.
fix
Specify -l en for English locale.
affects: all
deprecatedThe package uses 'commander' v2.x internally, which is outdated.
fix
No immediate fix; input parsing works but may have edge cases with complex arguments.
affects: >=1.0.0
breakingESM-only since v1.3.0; require() will fail.
fix
Use import syntax or dynamic import().
affects: >=1.3.0
gotchaThe tool ignores objects matching pattern in -i using simple substring match, not regex.
fix
Ensure ignore patterns are simple substrings.
affects: all
Errors
Common errors & fixes
Error: listen EADDRINUSE :::5432
Default port 5432 is already in use on localhost.
fix
Specify a different port with -p flag.
Error: CILOOP: too many symbolic links encountered
Unrelated system error, possibly due to circular symlinks in current directory.
fix
Run postgres-markdown from a different directory without symlink loops.
postgres-markdown: command not found
Package not installed globally or not in PATH.
fix
Install with 'npm install -g postgres-markdown' or use npx.
Upgrade
Version history
1.3.6latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client for Node.js
commanderrequiredCLI option parsing
Agent activity
7 hits · last 30 days
node
6
Resources
postgres-markdown — npm install postgres-markdown · libregistry