Skip to content

Conversation

@notfoundzzz
Copy link
Contributor

@notfoundzzz notfoundzzz commented Jan 23, 2026

如何测试

  1. 选择菜单插入-程序-代码块/行内代码或使用 \bash 或者 \bash-code插入代码块环境
  2. 输入一些Bash代码检查高亮
  • 测试文档: TeXmacs/tests/tmu/209_7.tmu

文件位置

  • 语言定义:TeXmacs/plugins/bash/progs/data/bash.scm
  • 样式包:TeXmacs/plugins/bash/packages/code/bash.ts
  • 编辑功能:TeXmacs/plugins/bash/progs/code/bash-edit.scm
  • 高亮功能:TeXmacs/plugins/bash/progs/code/bash-lang.scm
  • 文档:TeXmacs/plugins/bash/doc/bash.en.tmu

2026/01/29

What

  • 修复 Bash 代码模式下 #$#${#...} 中被误识别为注释的问题
  • 增加路径/URL 识别规则,避免路径/文件名中的关键字与数字误高亮(如 abc.git

How

  • prog_language.cpp 增加可配置的 path 解析步骤,位于 string_parser 之后、keyword/number 之前;匹配到路径/URL token 则整体消费
  • bash-lang.scm 中启用 path 解析
  • 注释规则增加 inline_require_space:仅当 # 位于行首或空白后才作为注释起始

2025/01/22

What

补充了bash-lang.scm中语法高亮的定义,增加了

  • 外部命令高亮(external_command)
    • GNU coreutils
    • 常用开发工具,如 gitghcodeclaude
    • 常用 alias(如 llgco

2025/01/20

What

为Mogan STEM添加Bash代码的语法高亮支持,包括语言定义文件和样式包。

Why

满足用户的插入Bash代码需求

关联 issue #2607

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@notfoundzzz notfoundzzz force-pushed the zhl/209_7/fix-bash-lang branch from d990e2d to c577f37 Compare January 26, 2026 09:12
if (inline_comment_parser.can_parse (s, pos)) {
// Special handling for bash: # is only a comment at start of line or
// after whitespace
if (lan_name == "bash" && pos < N (s) && s[pos] == '#') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不能加特殊规则


// Enable path boundary checking for bash to avoid highlighting commands in
// paths
if (name == "bash") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也不能加特殊规则

@notfoundzzz notfoundzzz force-pushed the zhl/209_7/fix-bash-lang branch from c577f37 to e9e472e Compare January 29, 2026 06:42
@notfoundzzz notfoundzzz force-pushed the zhl/209_7/fix-bash-lang branch from a05a5b2 to 2f5bafa Compare January 29, 2026 07:12
@notfoundzzz notfoundzzz changed the title [209_7] 修复bash代码模式下文件名路径等的错误高亮 [209_7] 修复bash代码模式下的错误高亮 Jan 29, 2026
Copy link
Contributor

@da-liii da-liii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@da-liii da-liii merged commit 29669bd into MoganLab:main Jan 29, 2026
4 checks passed
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.

2 participants