Port upstream code fence info string model#70
Conversation
1ade516 to
4ae69c7
Compare
192be0c to
2d49a16
Compare
|
Reviewed for the Android client: relevant (live fenced-code parsing, language-input editing, highlighting) and the port itself is faithful to upstream #4856 — Two problems needed fixing before this could land:
Also audited every remaining Verified: info-string spec battery 41/41 (including the updated #4770 spec), Muya gate 207 files / 1406 green, markdown rendering + editing E2E 9/9 (fenced code, math, Mermaid detection under the new model), app unit 258, production build green. |
Upstream
Ports marktext/marktext#4856: marktext/marktext#4856
This is stacked on #69 (
sync/upstream-4861-prism-dependency-order) because the new live Muya tests import the editor Prism path, and Android main still has the pre-#4861 Prism dynamic import issue that causes unrelatedlatex/yamlmodule resolution errors under Vitest.Android relevance
Android uses Muya for the WebView editor, including fenced code block parsing, live language input editing, serialization, and Prism highlighting. The upstream bug affects mobile editor behavior directly:
```js title="app.js"is currently reduced tojsin the model.language-*token can crash or produce invalid class handling unless highlighting derives only the first word.Changes
meta.langas the full fenced code info string, matching CommonMark's model.firstWordOfInfo()and use it where the actual syntax-highlight language is needed.language-*classes.meta.langverbatim.Verification
pnpm --dir third_party/muya exec vitest run src/utils/__tests__/firstWordOfInfo.spec.ts src/state/__tests__/infoStringModel.spec.ts src/block/content/codeBlockContent/__tests__/infoStringHighlight.spec.ts src/block/content/langInputContent/__tests__/editInfoString.spec.ts src/state/__tests__/blockSerialization.spec.tspnpm build