Skip to main content

Module metrics

Module metrics 

Source
Expand description

Content metrics — word count, estimated reading time, and a readability score.

Computed server-side at editor-open from the content-bearing extension widget values (the markdown / text fields the author is editing), so the editor shows metrics without opening the preview Pure functions — analyze takes a string and collect_widget_text gathers the text to feed it.

Structs§

ContentMetrics
Word count + reading time + readability for a chunk of content.

Functions§

analyze
Word count + reading time + Flesch reading ease for text. HTML tags and light markdown punctuation are stripped first, so the same function works on markdown source, rendered HTML, or plain text.
collect_widget_text
Concatenate the text of content-bearing widgets — Text, Textarea, Markdown, RichText — skipping choosers, numbers, booleans, and the like. The result feeds analyze.