npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@paulmeller/docflow-cli

v0.0.8

Published

CLI for DocFlow - transform documents between formats with table support

Downloads

22

Readme

DocFlow CLI

A command-line interface for DocFlow - transform documents between formats with table support.

Features

  • 📄 Convert documents between DOCX, Markdown, HTML, JSON, and plain text
  • 📊 Preserve tables when converting DOCX to Markdown
  • 🔍 Query document structure using CSS-like selectors
  • Transform content with uppercase, lowercase, titlecase, and sentencecase
  • 📋 Extract plain text without formatting
  • 🔗 Pipe from stdin for shell scripting integration

Installation

Global Installation (Recommended)

npm install -g @paulmeller/docflow-cli
docflow --help

Using npx (No Installation)

npx @paulmeller/docflow-cli convert -i document.docx -o document.md

Local Development

git clone <repo>
npm install
npm run build
node dist/cli.js --help

Global Options

  • -v, --verbose - Output the SuperDoc JSON structure after conversions (useful for debugging)
  • -V, --version - Display CLI version
  • -h, --help - Display help information

Verbose Mode Example

# See the internal JSON structure after conversion
docflow --verbose convert -i document.docx -o output.md

# Output includes the SuperDoc JSON representation
# Useful for debugging and understanding document structure

Commands

convert

Convert documents between formats. Auto-detects format from file extensions.

# DOCX to Markdown (preserves tables!)
docflow convert -i report.docx -o report.md

# Markdown to DOCX
docflow convert -i README.md -o README.docx

# DOCX to HTML
docflow convert -i document.docx -o document.html

# Specify output format explicitly
docflow convert -i input.docx -o output.txt -f text

Options:

  • -i, --input <file> - Input file path (required)
  • -o, --output <file> - Output file path (required)
  • -f, --format <format> - Output format: docx, markdown, html, json, text (optional)

convert-stdin

Convert content from stdin to a document. Perfect for piping and shell scripting.

# Pipe markdown to DOCX
echo "# Hello World" | docflow convert-stdin -o output.docx

# Convert text file to DOCX
cat README.md | docflow convert-stdin -o README.docx

# Generate HTML from markdown
echo "## Title\n\nContent" | docflow convert-stdin -o page.html -f html

Options:

  • -o, --output <file> - Output file path (required)
  • -f, --format <format> - Output format: docx, markdown, html, json, text (default: docx)

query

Query document structure using CSS-like selectors.

# Find all headings
docflow query -i document.docx -s "heading"

# Find level 2 headings only
docflow query -i document.docx -s "heading[level=2]"

# Count paragraphs
docflow query -i document.docx -s "paragraph" --count

# Extract heading text
docflow query -i document.docx -s "heading[level=1]" --text

Options:

  • -i, --input <file> - Input file path (required)
  • -s, --selector <selector> - CSS-like selector (required)
  • -c, --count - Show count only
  • -t, --text - Show text content only

transform

Transform document content using text transformations.

# Convert all H1 headings to uppercase
docflow transform -i input.docx -o output.docx -s "heading[level=1]" -t uppercase

# Convert paragraphs to lowercase
docflow transform -i input.docx -o output.docx -s "paragraph" -t lowercase

# Apply title case to H2 headings
docflow transform -i input.docx -o output.docx -s "heading[level=2]" -t titlecase

# Apply sentence case
docflow transform -i input.docx -o output.docx -s "heading" -t sentencecase

Options:

  • -i, --input <file> - Input file path (required)
  • -o, --output <file> - Output file path (required)
  • -s, --selector <selector> - CSS-like selector (required)
  • -t, --type <type> - Transform type: uppercase, lowercase, titlecase, sentencecase (required)

info

Display document structure and table of contents.

docflow info -i document.docx

Output example:

Document Structure:
==================
Total Headings: 15
  - H1: 3
  - H2: 8
  - H3: 4
Total Paragraphs: 42

Table of Contents:
==================
- Introduction
  - Overview
  - Getting Started
- Features
  - Core Features
  - Advanced Features

Options:

  • -i, --input <file> - Input file path (required)

extract-text

Extract plain text from a document without any formatting.

# Print to console
docflow extract-text -i document.docx

# Save to file
docflow extract-text -i document.docx -o output.txt

Options:

  • -i, --input <file> - Input file path (required)
  • -o, --output <file> - Output text file (optional, prints to console if not specified)

Use Cases

Shell Scripting

# Convert all DOCX files to Markdown
for file in *.docx; do
  docflow convert -i "$file" -o "${file%.docx}.md"
done

# Generate report from template
cat report_template.md | docflow convert-stdin -o monthly_report.docx

Document Analysis

# Count headings in a document
docflow query -i document.docx -s "heading" --count

# Extract all H1 headings
docflow query -i document.docx -s "heading[level=1]" --text

# Get document structure
docflow info -i document.docx

Batch Transformations

# Standardize heading case across multiple files
for file in *.docx; do
  docflow transform -i "$file" -o "processed_$file" -s "heading[level=1]" -t titlecase
done

Supported Formats

| Format | Extension | Read | Write | |--------|-----------|------|-------| | Microsoft Word | .docx | ✅ | ✅ | | Markdown | .md | ✅ | ✅ | | HTML | .html | ✅ | ✅ | | JSON | .json | ✅ | ✅ | | Plain Text | .txt | ✅ | ✅ |

Table Support

DocFlow CLI preserves tables when converting DOCX to Markdown:

DOCX Table: | Name | Age | City | |------|-----|------| | John | 25 | NYC | | Jane | 30 | LA |

Converts to Markdown:

| Name | Age | City |
|------|-----|------|
| John | 25  | NYC  |
| Jane | 30  | LA   |

Requirements

  • Node.js 18+ or higher

License

ISC

Related Projects

  • DocFlow - The underlying document transformation library
  • SuperDoc - Document processing engine

Contributing

Issues and pull requests are welcome!