Automattic / Automattic/harper

Add support for spaced ellipses

Open
#1,875 3 comments 2 reactions 0 assignees View on GitHub
enhancement harper-core punctuation stale
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 12h
Merged PRs (30d)
106

Description

**What problem does this solve?**

In older texts it was common for ellipses to use spaces between the dots, either with or without spaces on either side. I assume we'd mostly come across this in scanned texts?

This is quite apparent in the version of _The Great Gatsby_ Harper uses in its POS snapshot tests.

**Proposed Solution**

Probably just modify this function in `document.rs`:
```rs
fn uncached_ellipsis_pattern() -> Lrc {
let period = SequenceExpr::default().then_period();
Lrc::new(Repeating::new(Box::new(period), 2))
}
```

And probably also the `EllipsisLength` linter.

**Examples**

3 dots with a space on each side:
Image

4 dots with a space after but not before. Probably after sentences though:
Image

4 dots with a space after but not before. But definitely not after sentences:
Image

**Component**
- [x] Core engine
- [ ] Plugin/Extension
- [ ] Other: _____

Contributor guide

Open the contributing guide

Research direction

Start in document.rs at uncached_ellipsis_pattern and inspect the EllipsisLength linter to understand how spaced ellipses are currently detected. Run the existing POS snapshot tests, including the version of The Great Gatsby mentioned in the issue, then add coverage for the shown three- and four-dot spacing patterns. Done means the patterns are recognized consistently without breaking existing ellipsis behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.