BOHICA-LABS / BOHICA-LABS/writescore

Exclude code blocks and tables from em-dash detection

Open
#49 1 comment 0 reactions 0 assignees View on GitHub
stale
Dominant language
Python
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Problem

The em-dash detection in `formatting.py` counts `--` patterns in:
1. **CLI arguments** in fenced code blocks (e.g., `--target`, `--profile`, `--wait`)
2. **Table separators** (e.g., `|--------|----------------------|`)
3. **YAML frontmatter delimiters** (`---`)

This causes false positives. An article with many CLI examples gets flagged for "57 em-dashes" when the actual prose has zero.

## Current Detection (line 383)

```python
em_dashes = len(re.findall(r"—|--", text))
```

## Proposed Solution

Before counting em-dashes:
1. Strip fenced code blocks (content between ``` delimiters)
2. Strip inline code (content between single backticks)
3. Strip table formatting rows (lines matching `|[-|]+|`)
4. Strip YAML frontmatter (already proposed in #48)

This should only count em-dashes in actual prose content.

## Impact

Articles with CLI examples are unfairly penalized. Current "57 em-dashes" detection is almost entirely false positives from code examples.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.