fix: treat HTML nbsp as whitespace in reading time
All checks were successful
CodeAnt AI Review - Stage 1 / codeant-review (pull_request) Successful in 2m53s
All checks were successful
CodeAnt AI Review - Stage 1 / codeant-review (pull_request) Successful in 2m53s
This commit is contained in:
@@ -2,7 +2,7 @@ export const getReadingTime = (text: string): string => {
|
|||||||
if (!text) return "0 min read";
|
if (!text) return "0 min read";
|
||||||
|
|
||||||
// Remove HTML tags if present
|
// Remove HTML tags if present
|
||||||
const cleanText = text.replace(/<[^>]+>/g, "");
|
const cleanText = text.replace(/<[^>]+>/g, "").replace(/ /gi, " ");
|
||||||
if (!cleanText.trim()) return "0 min read";
|
if (!cleanText.trim()) return "0 min read";
|
||||||
|
|
||||||
// Count words
|
// Count words
|
||||||
|
|||||||
Reference in New Issue
Block a user