mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-10-01 09:19:34 +05:30
- src/utils/writing-stats.js — pure module: stripMarkdown() drops fenced code blocks, inline code, image URLs, link URLs, headings, blockquote markers, list bullets, and emphasis markers so the word count reflects the prose a reader actually consumes (the convention used by Hemingway, iA Writer). splitSentences / countSyllables use Flesch's standard heuristics. computeStats returns wordCount, sentenceCount, syllableCount, readingTimeMinutes (default 220 wpm), fleschKincaidGrade, charCount. - src/renderer.js — _updateStatusBar now calls computeStats and updates three new status items: ~X min read, Grade N.N, and the existing Words + Chars counters use the stripped count. - src/index.html — two new status items: #reading-time and #grade-level. Tests (23 new, tests/writing-stats.test.js): markdown stripping (fenced, inline, images, links, wikilinks, headings, lists, emphasis, HTML), sentence splitter edge cases, syllable heuristic (short words, silent e, empty), and computeStats with custom wpm + null-safe inputs. Full suite: 68 suites, 789 tests, lint+format clean. Amit Haridas