Metadata-Version: 2.4
Name: emdashify
Version: 0.4.0
Summary: Convert double hyphens into em dashes in Python, Markdown, and Word documents. No AI required.
Author: edujbarrios
License-Expression: BSD-3-Clause-Attribution
Project-URL: Homepage, https://github.com/edujbarrios/EmDashify
Project-URL: Repository, https://github.com/edujbarrios/EmDashify
Project-URL: Issues, https://github.com/edujbarrios/EmDashify/issues
Keywords: em dash,typography,text,markdown,cli,unicode,ai writing,word document,docx
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing
Classifier: Topic :: Text Processing :: Markup :: Markdown
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: word
Requires-Dist: python-docx<2,>=1.2.0; extra == "word"
Dynamic: license-file

# EmDashify — Em Dashes Made Easy

[![PyPI v0.4.0](https://raw.githubusercontent.com/edujbarrios/EmDashify/main/assets/badges/pypi.svg)](https://pypi.org/project/emdashify/)
[![Python 3.10+](https://raw.githubusercontent.com/edujbarrios/EmDashify/main/assets/badges/python.svg)](https://pypi.org/project/emdashify/)
[![Tests](https://img.shields.io/github/actions/workflow/status/edujbarrios/EmDashify/tests.yml?branch=main&label=tests&logo=githubactions)](https://github.com/edujbarrios/EmDashify/actions/workflows/tests.yml)
[![License](https://img.shields.io/badge/license-BSD--3--Clause--Attribution-blue)](https://github.com/edujbarrios/EmDashify/blob/main/LICENSE)

**The Python library you think you'll never need—until you use it more than the ones you do.**

## Why?

ChatGPT, Claude, and other large language models often use the em dash (`—`) when answering users. It's become especially noticeable in AI-generated responses: [Pew Research Center](https://www.pewresearch.org/data-labs/2026/08/20/how-much-of-the-internet-is-written-with-ai/) found that em dashes appeared **about twice as often** in the English-language web text it studied as in 2023. Of course, the em dash predates AI—it's ordinary punctuation, not proof that a text was AI-written.

Yet most QWERTY keyboards have a `-` key, **not a dedicated `—` key**. EmDashify lets you type `--` and turn it into a proper em dash in text, Markdown, or Word documents. No AI needed. Just punctuation.

## Quick start

```bash
pip install emdashify
emdashify "Hello -- world"
# Hello—world
```

```python
from emdashify import convert

convert("Hello -- world")                  # 'Hello—world'
convert("hello--world")                    # 'hello—world'
convert("Hello -- world", compact=False)   # 'Hello — world'
```

## Edit files in place (with a backup)

Prefer updating the file directly? Add `--in-place` to convert it **safely**, keeping the unmodified original as a `.bak` file:

```bash
emdashify --file notes.md --in-place     # saves notes.md.bak
emdashify --file draft.docx --in-place   # saves draft.docx.bak (requires [word])
```

```python
from emdashify import convert_in_place

convert_in_place("notes.md")  # True if changed, False if already clean
```

Existing backups are never overwritten. No backup is created if the document is already clean. Symlinks are not edited in place, and writing a file over itself with `--output` is rejected.

## Word documents (.docx)

Convert an entire Word document, including paragraphs, tables, headers and footers, **without flattening text formatting**. Install the optional Word extra:

```bash
pip install "emdashify[word]"
emdashify --file draft.docx --output draft-fixed.docx
emdashify --file draft.docx --check
```

```python
from emdashify import convert_docx

convert_docx("draft.docx", "draft-fixed.docx")
```

By default, the source file is untouched; use `--in-place` for an explicit backup-protected update. Word support is for `.docx`, **not legacy `.doc`**. Review complex documents with tracked changes or advanced Word fields after conversion.

## Text and Markdown files

```bash
emdashify --file notes.md --diff
emdashify --file notes.md --output notes-fixed.md
emdashify --file notes.md --check
```

**Compact by default:** both `word--word` and `word -- word` become `word—word`. Flags (`--help`), dates, and `---` stay unchanged; Markdown code blocks are protected. Use `--spaced` in the CLI (or `compact=False` in Python) to retain the former spaced style.

Requires Python 3.10+. For development or publishing, see [release instructions](https://github.com/edujbarrios/EmDashify/blob/main/docs/RELEASING.md).

## License

[BSD-3-Clause-Attribution](https://github.com/edujbarrios/EmDashify/blob/main/LICENSE). Redistributing EmDashify requires retaining license notices and this acknowledgment:

> This product includes software developed by edujbarrios (https://github.com/edujbarrios/EmDashify).
