[ BUG ] TOC links break when a path with a space is one of several inputs
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 84/100
Hướng nghiên cứu
Tiền tố đường dẫn được thêm trong internal/core/toc/renderer.go, tại Renderer.Render. Trước tiên, hãy đọc hàm đó và các bài kiểm thử renderer hiện có. Mã hóa khoảng trắng trong tiền tố liên kết thành %20, sau đó xác nhận rằng đầu vào không có khoảng trắng và thông báo lỗi vẫn giữ nguyên đầu ra hiện tại; ví dụ tái hiện trong issue cho biết TOC mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
With several inputs, every TOC entry links to <input>#<anchor>, with the input as given
on the command line. When the input has a space, the link is not valid Markdown, and
GitHub renders the entry as plain text. The names of GitHub wiki pages can have spaces.
The Bash version had the same bug (ekalinin/github-markdown-toc#76) and fixed it in
ekalinin/github-markdown-toc#190.
To Reproduce
mkdir "test directory"
printf '# Title one\n\n## Section\n' > "test directory/a.md"
printf '# Title two\n' > "test directory/b.md"
gh-md-toc --hide-footer "test directory/a.md" "test directory/b.md"
Actual:
* [Title one](test directory/a.md#title-one)
* [Section](test directory/a.md#section)
* [Title two](test directory/b.md#title-two)
The GitHub Markdown API renders the first entry as
<li>[Title one](test directory/a.md#title-one)</li>, without a link.
Expected behavior
As in the Bash version, every space in the link prefix is replaced with %20, and no
other character changes:
* [Title one](test%20directory/a.md#title-one)
* [Section](test%20directory/a.md#section)
* [Title two](test%20directory/b.md#title-two)
Inputs without a space give the same output as now. Messages that show the input, such
as errors, keep it as given.
Environment (please complete the following information):
- OS: macOS (darwin/arm64)
- Version: 2.0.1, current
master(dd680f7)
Additional context
- The prefix is added in
Renderer.Render(internal/core/toc/renderer.go):
link = path + link. - With
--insert, local files get bare anchors, so the TOC written into them is not
affected.
- Ngôn ngữ chính
- Go
- Star
- 525
- Fork
- 89
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ekalinin/github-markdown-toc.go
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Tất cả issue của ekalinin/github-markdown-toc.go
Issue tương tự
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeoutCó thể đã có người làm @floriankoch đã nhận hôm nay. Đang mởtriage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
envoyproxy/gateway#10562 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Adding an LDAP group reports every search failure as "LDAP Group DN is not found"Có thể đã có người làm @Daksha1611 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
[Bug] K8s reconcile still resets explicit 0 to defaults for response_api, memory and flow stateCó thể đã có người làm @Bevisy đã nhận hôm nay. Đang mởneeds-acceptance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
vllm-project/semantic-router#5998 ·
Maintainer thường phản hồi trong vòng 2 ngày