Skip to content

Commit 93d0e93

Browse files
halfrostclaude
andcommitted
Add .gitattributes so GitHub Linguist detects Go as the primary language
The repo commits the generated Hugo site (website/public, ~450MB of HTML) and a bilingual Markdown book, which by raw bytes dwarf the Go source, causing GitHub to classify the project as HTML. Classify non-code per Linguist semantics: - website/public/** -> linguist-generated (built site output) - website/themes/** -> linguist-vendored (third-party Hugo theme) - *.md -> linguist-documentation (prose write-ups, READMEs) - PDF*.md -> linguist-generated (ctl-generated merged dumps) After this, counted bytes are Go ~1.5MB (top) > JSON ~0.28MB > JS ~0.11MB. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3bcc916 commit 93d0e93

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.gitattributes

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# 让 GitHub Linguist 重新把本仓识别为 Go 项目。
2+
#
3+
# 本仓除了 Go 题解,还提交了「Hugo 构建产物」和一本双语「Markdown 书」,
4+
# 二者按字节数远大于 Go 源码(HTML ~476MB、Markdown ~10MB、Go ~1.5MB),
5+
# 导致语言被判成 HTML。这里按 Linguist 语义给非代码内容正确归类,
6+
# 使语言统计只反映真正的 Go 源码。
7+
#
8+
# 归类后计入统计的字节:Go ~1.5MB(第一) > JSON ~0.28MB > JS ~0.11MB。
9+
# 说明:Linguist 在【推送到默认分支】后重算,语言条可能需要几分钟刷新。
10+
11+
# Hugo 构建产物(生成的静态站点)——排除出统计,diff 里折叠
12+
website/public/** linguist-generated=true
13+
14+
# 第三方 Hugo 主题(含 flexsearch / workbox 等库)——vendored,排除出统计
15+
website/themes/** linguist-vendored=true
16+
17+
# 所有 Markdown(题解讲解、书籍正文、README)都是文档/散文,非源码——排除出统计
18+
*.md linguist-documentation=true
19+
20+
# ctl 工具生成的整本合并 Markdown 大文件——按生成物处理(顺带折叠其巨大 diff)
21+
PDF*.md linguist-generated=true

0 commit comments

Comments
 (0)