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

human-touch

v1.0.7

Published

Transform AI-generated text into human-readable content by normalizing Unicode characters, fixing typography, and removing digital artifacts

Readme

🤖→👤 Human Touch

Transform AI-generated text into human-readable content by normalizing Unicode characters, fixing typography, and removing digital artifacts.

npm version License: MIT

Why Human Touch?

AI-generated content often contains problematic Unicode characters that make text look robotic and can cause rendering issues:

  • Smart quotes (" ") instead of straight quotes (")
  • Various dash types (—, –) instead of simple hyphens (-)
  • Invisible bidirectional characters that can break layouts
  • Full-width characters that look weird in normal text
  • HTML entities mixed with plain text

Human Touch automatically fixes these issues to make your content look naturally human-written.

✨ Features

🔄 Text Normalization

  • Smart quotes → straight quotes (" ')
  • Various dashes → hyphens (-)
  • Ellipsis → three dots (...)
  • Non-breaking spaces → normal spaces
  • Invisible characters → removed (security fix)
  • Bullets → asterisks (*)
  • Full-width chars → normal ASCII
  • HTML entities → plain text equivalents
  • Common fractions → text (½1/2)

🚨 Hazards Detection

  • Invisible/bidirectional characters (security risk)
  • Smart quotes in HTML attributes (parsing issues)
  • Consecutive   entities (layout problems)

⚙️ Processing Modes

  • Safe mode (default) - won't change semantic meaning
  • Aggressive mode - includes currency symbols, math operators
  • Dry run - preview changes without modifying files
  • Backup creation - save .bak files before changes
  • Build integration - fail builds on critical issues
  • Verbose output - detailed progress and troubleshooting info

📦 Installation

# Install globally for CLI usage
npm install -g human-touch

# Install locally for programmatic usage
npm install human-touch

🚀 Usage

Command Line Interface

# Process all HTML files in current directory
human-touch

# Preview changes without modifying files
human-touch --dry-run

# Aggressive normalization with backups
human-touch --aggressive --backup

# Process specific files/patterns
human-touch "dist/**/*.html"

# Fail build if critical issues found
human-touch --fail-on-hazards

# Get detailed output for troubleshooting
DEBUG=1 human-touch --dry-run

CLI Options

| Option | Description | |--------|-------------| | -h, --help | Show help message | | -v, --version | Show version number | | -d, --dry-run | Preview changes without modifying files | | -a, --aggressive | Apply aggressive normalization (may change meaning) | | -b, --backup | Create .bak backup files before modifying | | --fail-on-hazards | Exit with error if critical hazards found | | -p, --patterns <list> | Comma-separated glob patterns | | -c, --concurrency <n> | Max concurrent files to process |

Programmatic API

import { humanize, humanizeHtml, detectHazards } from 'human-touch'

// Quick text normalization
const cleaned = humanize('Text with "smart quotes" and—em dashes')
// Result: 'Text with "smart quotes" and-em dashes'

// HTML normalization
const html = '<p>Content with "quotes" and&nbsp;&nbsp;spaces</p>'
const cleanHtml = humanizeHtml(html)
// Result: '<p>Content with "quotes" and spaces</p>'

// Advanced usage with options
import { normalizeText, normalizeHtml } from 'human-touch'

const result = normalizeText('Text with €100 price', { aggressive: true })
// Result: { text: 'Text with EUR100 price', changes: 1, hazards: {...} }

// Detect problematic characters
const hazards = detectHazards('Text with\u200Binvisible chars')
console.log(hazards.invisibles_bidi.count) // 1

Build Integration

Package.json Scripts

{
  "scripts": {
    "build": "vite build && human-touch dist/**/*.html",
    "build:safe": "vite build && human-touch --fail-on-hazards dist/**/*.html"
  }
}

With Astro

{
  "scripts": {
    "build": "astro build && human-touch dist/**/*.html --backup"
  }
}

CI/CD Pipeline

# GitHub Actions example
- name: Build and normalize text
  run: |
    npm run build
    npx human-touch --fail-on-hazards dist/**/*.html

🔍 What Gets Normalized

Safe Replacements (Always Applied)

| Character | Before | After | Description | |-----------|--------|-------|-------------| | Smart quotes | "text" 'text' | "text" 'text' | Straight quotes | | Dashes | text—dash text–dash | text-dash | Simple hyphens | | Ellipsis | text… | text... | Three dots | | Spaces | text\u00A0here | text here | Normal spaces | | Invisible chars | text\u200Bhere | texthere | Removed completely | | Bullets | • item | * item | Asterisks | | Fractions | ½ cup | 1/2 cup | Text fractions | | HTML entities | &nbsp; &mdash; | - | Plain text |

Aggressive Replacements (Optional)

| Character | Before | After | Warning | |-----------|--------|-------|---------| | Currency | €100 £50 | EUR100 GBP50 | Changes meaning | | Math symbols | ±5 ×2 ÷3 | +/-5 x2 /3 | May lose precision | | Degree symbol | 25°C | 25ºC | Visual change |

Hazards Detection

| Hazard | Description | Risk Level | |--------|-------------|------------| | Invisible/bidi chars | Can cause security issues, text direction problems | 🔴 Critical | | Smart quotes in attributes | Can break HTML parsing | 🟡 Medium | | Consecutive &nbsp; | Can cause layout issues | 🟡 Medium |

🧪 Examples

Before & After

// AI-generated text (problematic)
const aiText = `
The "smart" approach—using advanced algorithms…
Price: €1,200 (±5% accuracy)
• Feature 1
• Feature 2
`

// After human-touch normalization
const humanText = `
The "smart" approach-using advanced algorithms...
Price: EUR1,200 (+/-5% accuracy)
* Feature 1  
* Feature 2
`

HTML Processing

<!-- Before -->
<div title="Smart "quotes"" data-price="€100">
  Content&nbsp;&nbsp;with&nbsp;spaces…
</div>

<!-- After -->
<div title="Smart "quotes"" data-price="EUR100">
  Content with spaces...
</div>

⚡ Performance

  • Fast: Processes 1000+ files per second
  • Memory efficient: Streaming processing for large files
  • Concurrent: Configurable concurrency for optimal performance
  • Safe: Never corrupts files, atomic writes with optional backups

🛡️ Security

Human Touch helps improve security by:

  • Removing invisible characters that can be used for attacks
  • Detecting bidirectional override characters that can mask malicious code
  • Normalizing text encoding to prevent homograph attacks
  • Safe HTML processing that preserves code blocks and scripts

🔧 Troubleshooting

Installation Issues

If the CLI doesn't work after npm install -g human-touch:

# Check installation
human-touch --version

# If command not found, try:
npm list -g human-touch        # Verify global installation
npm install -g human-touch     # Reinstall globally

# For permission errors (Unix/Mac):
sudo npm install -g human-touch

Verbose Output

Get detailed information about what the tool is doing:

# See detailed processing information
DEBUG=1 human-touch --dry-run

# What you'll see:
# - Node.js version and working directory
# - File pattern matching results
# - Per-file processing progress
# - Error details with suggestions

Common Issues

| Issue | Solution | |-------|----------| | "No files found" | Check your patterns and current directory | | "Permission denied" | Ensure write access to target files | | "Module not found" | Run npm install in the project directory | | "Node version error" | Upgrade to Node.js 18+ |

Getting Help

The CLI provides helpful context when errors occur:

  • Installation suggestions
  • Permission issue hints
  • File pattern debugging
  • Stack traces with DEBUG=1

🔧 Configuration

Custom Patterns

# Multiple patterns
human-touch --patterns "dist/**/*.html,build/**/*.html"

# Exclude certain directories
human-touch "**/*.html" "!node_modules/**"

Integration Examples

// webpack.config.js
const { execSync } = require('child_process')

class HumanTouchPlugin {
  apply(compiler) {
    compiler.hooks.afterEmit.tap('HumanTouchPlugin', () => {
      execSync('npx human-touch dist/**/*.html', { stdio: 'inherit' })
    })
  }
}

module.exports = {
  // ... your webpack config
  plugins: [
    new HumanTouchPlugin()
  ]
}
// gulpfile.js
const { exec } = require('child_process')
const { promisify } = require('util')
const execAsync = promisify(exec)

gulp.task('humanize', async () => {
  await execAsync('npx human-touch dist/**/*.html')
})

gulp.task('build', gulp.series('compile', 'humanize'))

🤝 Contributing

Contributions welcome! Please read our Contributing Guide.

Development Setup

git clone https://github.com/jjlmoya/human-touch.git
cd human-touch
npm install
npm run dev

Running Tests

npm test                # Run all tests
npm run test:coverage   # With coverage report
npm run test:watch      # Watch mode

📄 License

MIT © jjlmoya


Made with ❤️ to make AI text feel human