Skip to content

perf: keep style docs out of the shared Markdown parser - #8

Closed
liuly0322 wants to merge 1 commit into
mainfrom
perf/lazy-doc-markdown
Closed

liuly0322 wants to merge 1 commit into
mainfrom
perf/lazy-doc-markdown

Conversation

@liuly0322

Copy link
Copy Markdown
Owner

Summary

This change removes the full react-markdown dependency from the shared application path used by style-property documentation. Doc now uses a small dependency-free React renderer for the Markdown features present in the MapLibre style specification: paragraphs, links, images, inline code, emphasis, lists, fenced code blocks, blockquotes, and thematic breaks.

Agent messages keep using react-markdown with remark-gfm. Because ModalAgentWorkspace is already loaded through the existing async boundary, both the workspace and its chat Markdown implementation are now contained in the same async Agent chunk. This avoids a second Markdown renderer request when the workspace becomes available.

Size comparison

Compared with main, the shared dataset chunk decreases from 153.02 kB to 37.62 kB raw, and from 47.88 kB to 13.28 kB gzip.

The entry bundle grows slightly from 2,429.57 kB to 2,434.59 kB raw because the lightweight renderer is now part of the entry. However, the entry plus the JavaScript files listed as modulepreload in index.html decreases from about 2,739.96 kB to 2,629.58 kB raw, and from 762.79 kB to 729.82 kB gzip. That is a reduction of about 110.38 kB raw and 32.97 kB gzip on the critical initial JavaScript path.

The async Agent chunk grows from 92.48 kB to 207.50 kB raw, and from 26.40 kB to 60.44 kB gzip. It now includes the full Agent Markdown stack, so chat Markdown is ready when the Agent workspace chunk finishes; no separate react-markdown chunk is emitted.

Validation

  • npm run lint
  • npm run lint-css
  • npm run test-unit — 21 files, 108 tests passed
  • Production build passed
  • Playwright E2E could not launch in this environment because the Chromium executable is not installed

@liuly0322 liuly0322 closed this Sep 13, 2026
@liuly0322

Copy link
Copy Markdown
Owner Author
  1. 当前文档样式仍然需要调整,sdk 支持表格溢出(因为标题 [global-state](https://maplibre.org/maplibre-style-spec/expressions/#global-state) expression)太长,需要修复样式;考虑标题是否要解析。
  2. react-markdown 太重的问题确实存在,但需要重新考虑边界,设计预加载策略。
  3. 先关闭,依赖其他 PR 先解决好上面的前序问题。

@liuly0322
liuly0322 deleted the perf/lazy-doc-markdown branch September 13, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant