Serializer keeps a link open across a whitespace-only marked node

Đang mở
#1,263 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Start in MarkdownSerializerState.renderInline and the expelEnclosingWhitespace step it relies on, since the issue traces the bug to renderInline setting marks = active for a whitespace-only marked node. Reproduce with the BaseSchemaSpecs, LinkSpecs and BoldSpecs setup from the issue and confirm the output drops the autolink. Done means the link is closed before the space is written, the serializer test prints the autolink followed by text, and a parsing regression test covers the round trip.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

MarkdownSerializerState.renderInline keeps the previous link active when the next node contains only marked whitespace.

Reproduce with BaseSchemaSpecs, LinkSpecs and BoldSpecs:

const href = 'https://ya.ru/';
const content = doc(p(a({href}, href), bold(' '), 'text'));

serializer.serialize(content);

Expected:

<https://ya.ru/> text

Actual:

<https://ya.ru/ >text

The result is not a valid autolink. After parsing, < and > become visible text.

When expelEnclosingWhitespace removes all text from the bold node, renderInline sets marks = active. This keeps the previous link open while writing the space, although the original space node has no link mark.

Close marks absent from the original node before writing its whitespace. Add regression tests for serialization and parsing.

Ngôn ngữ chính
TypeScript
Star
428
Fork
48
Merge trung bình
5 ngày 15 giờ
Pull request đã merge (30 ngày)
47

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của gravity-ui/markdown-editor

Tất cả issue của gravity-ui/markdown-editor

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.