fix(流程图): 老师给的参考流程图是一堆彩色方框,和学生画的标准符号对不上

题面里的 36 张参考图都是 2026-10 之前手写的 Mermaid,一个框的种类都没标,只能按字分彩色。
显示前按写法和字认框(花括号是判断、开始结束是起止、以输入 / 输出 / 打印开头或写着
input( / print( 的是输入输出框,其余是处理框),换成标准形状和配色。数据不动;
学生的老提交都标了种类,不受影响。36 张全部渲染过,框数不变。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-19 22:18:28 +08:00
1 parent 941cd64252
commit c4306b092d
2 files changed
+117 -1

No files matched your search

@@ -6,6 +6,8 @@
* pele 的版本号锁死(不带 ^):项目 2026-10 才开,小版本也在改排版。
*/
import { normalizeLegacyFlowchart } from "utils/legacyFlowchart"
const semanticNodeClasses = [
"startNode",
"endNode",
@@ -135,7 +137,8 @@ export function useMermaid() {
try {
// pele/lazy 按图的类型现拉对应的模块,题目里绝大多数是流程图,只拉那一块
const { renderAsync } = await import("pele/lazy")
const { svg } = await renderAsync(mermaidCode, {
// 老师手写的老参考图一个框的种类都没标,先按标准符号重排(见 legacyFlowchart.ts)
const { svg } = await renderAsync(normalizeLegacyFlowchart(mermaidCode), {
// 量字宽用页面真实的字体,否则框会比字窄或宽
fontFamily: getComputedStyle(container).fontFamily,
// 题目是老师写的、提交是学生写的,图里的链接和外链图片一律不画