From c42996721ae75fa386966b934c12bd467bf1e8e6 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Mon, 26 Sep 2022 15:46:03 +0800 Subject: [PATCH] Start at index 3, because the frontend starts two nodes above the backend --- packages/text-to-speech/src/htmlToSsml.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/text-to-speech/src/htmlToSsml.ts b/packages/text-to-speech/src/htmlToSsml.ts index cc0506c76..f7ec2cef0 100644 --- a/packages/text-to-speech/src/htmlToSsml.ts +++ b/packages/text-to-speech/src/htmlToSsml.ts @@ -105,9 +105,9 @@ function parseDomTree(pageNode: Element) { visitedNodeList.shift() visitedNodeList.forEach((node, index) => { - // We start at index 2, because the frontend starts one node above us - // on the #readability-content element that wraps the entire content. - node.setAttribute('data-omnivore-anchor-idx', (index + 2).toString()) + // We start at index 3, because the frontend starts two nodes above us + // on the #readability-page-1 element that wraps the entire content. + node.setAttribute('data-omnivore-anchor-idx', (index + 3).toString()) }) return visitedNodeList }