Repository navigation
[1344] 将 gf-highlight 高亮引擎内置到 gfcode - #38
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
任务背景
将 gf-highlight 高亮引擎完整内置到 gfcode,作为无下游依赖的独立
highlightdomain,使后续 app 可通过(liii highlight ...)使用 Diff、Markdown 与各编程语言高亮,减少同步上游的成本。上游来源:gitee.com/MoganLab/gf-highlight(commit 432a035,v2026.11.24)。
实现概要
gfproject.json:新增highlightdomain(root: highlight/,depends-on: [],mode: r7rs),暂不给 app 加高亮依赖gf_fmt.json:将highlight/加入 Scheme 格式化范围(liii highlight ...)模块名与definition.scm基于library-file的资源定位拆分超限实现模块(gfcheck 单文件 450 行限制)
上游
rule.scm(578 行)、highlighter.scm(660 行)超出限制,按职责拆分,依赖方向单向、API 与行为不变:rule.scmrule-matcher.scmhighlighter.scmcontext-stack.scmcode-block.scmdefinition.scm/theme.scm/tui-render.scmrule不再 re-export 匹配结果(避免 gfcheck unit-test 规则错位),由highlighter直接 importrule-matcher。拆分超限测试并补单元测试
highlight-text-test.scm(526 行)→ 主文件 +highlight-text-e2e-test.scmload-syntax-definition-test.scm(770 行)→ 主文件 + langs-1/2/3 三个批次context-stack、code-block测试与库导览 README新增验收测试
load-syntax-definition-cwd-test.scm:chdir 后library-file仍定位资源highlight-text-to-ansi-utf8-test.scm:中文渲染不发生 UTF-8 断裂highlight-text-test.scm增加 Markdown fenced Diff 嵌套高亮用例验证结果
load-syntax-definition、load-definition-for-file、highlight-line、highlight-text、highlight-line-to-ansi、highlight-text-to-ansi、render-spans-to-ansi、default-breeze-dark-themetools/cat;未复制.git、.DS_Store或构建缓存上游同步版本
gitee.com/MoganLab/gf-highlight commit 432a035(fix(definition): 加载期用 (liii sys) library-file 定位 resources/syntax)。