• Will Chen's avatar
    Use specific languages for shiki (#1938) · 1ce39958
    Will Chen 提交于
    <!-- CURSOR_SUMMARY -->
    > [!NOTE]
    > Refactors code highlighting to use react-shiki/core with a singleton
    highlighter and preloaded langs/themes, adds a fallback renderer, bumps
    react-shiki, and adds tests for message summarization.
    > 
    > - **Frontend**
    > - **CodeHighlight** (`src/components/chat/CodeHighlight.tsx`): Replace
    `useShikiHighlighter` with `ShikiHighlighter` from `react-shiki/core`
    using a singleton `createHighlighterCore` and JS regex engine; preload
    common languages and GitHub light/dark themes; add `<pre><code>`
    fallback while loading.
    > - **Tests**
    > - Add/expand Vitest suite for `formatMessagesForSummary`
    (`src/__tests__/formatMessagesForSummary.test.ts`): covers truncation,
    ordering, special chars, undefined content, and edge cases.
    > - **Dependencies**
    >   - Upgrade `react-shiki` to `^0.9.0` in `package.json`.
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    b32d224cd21d3c76e77799f2995905e523406bf9. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    
    
    
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Preloaded a specific set of Shiki languages and themes using react-shiki
    core, and updated CodeHighlight to use a singleton highlighter. This
    reduces bundle size and stabilizes code rendering with a simple fallback
    while loading.
    
    - **Refactors**
    - Switched to react-shiki/core with ShikiHighlighter and a singleton
    highlighter.
    - Preloaded common languages
    (js/ts/jsx/tsx/html/css/json/markdown/python/etc.) and GitHub light/dark
    themes.
    - Used the JavaScript regex engine and added a plain <pre><code>
    fallback until the highlighter is ready.
    
    - **Dependencies**
      - Upgraded react-shiki to ^0.9.0.
    
    <sup>Written for commit b32d224cd21d3c76e77799f2995905e523406bf9.
    Summary will update automatically on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    1ce39958
名称
最后提交
最后更新
..
azure 正在载入提交数据...
backups 正在载入提交数据...
engine 正在载入提交数据...
gateway 正在载入提交数据...
images 正在载入提交数据...
import-app 正在载入提交数据...
security-review 正在载入提交数据...
1.md 正在载入提交数据...
2.md 正在载入提交数据...
3.md 正在载入提交数据...
4.md 正在载入提交数据...
5.md 正在载入提交数据...
6.md 正在载入提交数据...
add-supabase.md 正在载入提交数据...
basic.md 正在载入提交数据...
chat1.md 正在载入提交数据...
chat2.md 正在载入提交数据...
context-limit-response.md 正在载入提交数据...
create-error.md 正在载入提交数据...
create-multiple-errors.md 正在载入提交数据...
create-ts-errors-complex.md 正在载入提交数据...
create-ts-errors.md 正在载入提交数据...
create-unfixable-ts-errors.md 正在载入提交数据...
dyad-write-angle.md 正在载入提交数据...
edit-made-with-dyad.md 正在载入提交数据...
execute-sql-1.md 正在载入提交数据...
execute-sql-no-description.md 正在载入提交数据...
generate-supabase-client.md 正在载入提交数据...
partial-write.md 正在载入提交数据...
rename-edit.md 正在载入提交数据...
version-integrity-add-edit-delete.md 正在载入提交数据...
version-integrity-move-file.md 正在载入提交数据...
write-index-2.md 正在载入提交数据...
write-index.md 正在载入提交数据...