INNER CODE UNIT · TypeScript

half

RyanYipeng/SyncCaster · apps/extension/src/content-scripts/index.ts:323

    const half = len / 2;
    const firstHalf = text.substring(0, half);
    const secondHalf = text.substring(half);
    if (firstHalf === secondHalf) {
      console.log('[math] Simple repeated formula:', secondHalf);
      return secondHalf;
    }
  }
  
  // 情况2:包含 LaTeX 特殊字符的复杂公式
  // 策略:找到渲染文本和 LaTeX 的分界点
  const latexSpecialChars = /[_{}\\^]/;
  let firstSpecialIdx = -1;
  for (let i = 0; i < text.length; i++) {
    if (latexSpecialChars.test(text[i])) {
      firstSpecialIdx = i;
      break;
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…