File tree Expand file tree Collapse file tree
packages/react/src/jsx-ast Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,6 +50,12 @@ export const TOC_MAX_HEADING_DEPTH = 3;
5050// 'Type: '.length
5151export const TYPE_PREFIX_LENGTH = 6 ;
5252
53+ // Reading speed behind a page's estimated reading time
54+ export const WORDS_PER_MINUTE = 200 ;
55+
56+ // Hiragana, CJK ideographs and Hangul syllables each read as one word
57+ export const CJK_CHARACTERS = / [ \u3040 - \u309f \u4e00 - \u9fff \uac00 - \ud7a3 ] / gu;
58+
5359/**
5460 * HTML tag to UI component mappings
5561 */
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ import {
2626 ALERT_LEVELS ,
2727 TYPES_WITH_METHOD_SIGNATURES ,
2828 TYPE_PREFIX_LENGTH ,
29+ WORDS_PER_MINUTE ,
30+ CJK_CHARACTERS ,
2931} from '../constants.mjs' ;
3032import { createJSXElement } from './ast.mjs' ;
3133import { extractHeadings , extractTextContent } from './buildBarProps.mjs' ;
@@ -38,12 +40,8 @@ import {
3840
3941const wordSegmenter = new Intl . Segmenter ( 'en' , { granularity : 'word' } ) ;
4042
41- // Hiragana, CJK ideographs and Hangul syllables each read as one word
42- const CJK_CHARACTERS = / [ \u3040 - \u309f \u4e00 - \u9fff \uac00 - \ud7a3 ] / gu;
43-
4443/**
45- * Estimates the reading time of a page's text, as display text,
46- * at 200 words per minute.
44+ * Estimates the reading time of a page's text, as display text.
4745 *
4846 * @param {string } text
4947 * @returns {string }
@@ -57,7 +55,7 @@ const readingTime = text => {
5755 }
5856 }
5957
60- return `${ Math . ceil ( words / 200 ) } min read` ;
58+ return `${ Math . ceil ( words / WORDS_PER_MINUTE ) } min read` ;
6159} ;
6260
6361/**
You can’t perform that action at this time.
0 commit comments