jlevy / jlevy/chopdiff

Paragraph.code_language / Paragraph.code_line_count

Open
#18 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
27
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Surfaced during [pprose](https://github.com/jlevy/practical-prose) structural-metrics work after the chopdiff 0.3.1 upgrade. Not blocking — pprose has a source-text workaround — but landing this lets pprose drop it.

**Need:** Per fenced-code block, expose the info-string language and the body line count, so pprose can report `fenced_code_counts_by_language` and `total_code_line_count`.

**Proposed API** (valid when `block_type` is `code`):

```python
Paragraph.code_language -> str | None # fence info string, first token
Paragraph.code_line_count -> int # body lines, excluding the fences
```

**pprose workaround today:** Parse the fence line and count body lines from the `code` block's source text.

_Tracked in pprose as `pp-9cmv`._

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.