refactor(content-blog): replace reading-time with Intl.Segmenter API (#11138)

Co-authored-by: sebastien <lorber.sebastien@gmail.com>
This commit is contained in:
Shreedhar Bhat 2025-05-15 16:52:00 +05:30 committed by GitHub
parent c419d7ec88
commit 9f6360ba82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 96 additions and 69 deletions

View file

@ -109,17 +109,18 @@ type EditUrlFunction = (params: {
```ts
type ReadingTimeOptions = {
wordsPerMinute: number;
wordBound: (char: string) => boolean;
};
type ReadingTimeCalculator = (params: {
content: string;
locale: string;
frontMatter?: BlogPostFrontMatter & Record<string, unknown>;
options?: ReadingTimeOptions;
}) => number;
type ReadingTimeFn = (params: {
content: string;
locale: string;
frontMatter: BlogPostFrontMatter & Record<string, unknown>;
defaultReadingTime: ReadingTimeCalculator;
}) => number | undefined;