Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Multiple headings on a single line without newline are broken between MD and RT modes

Đang mở
#153 0 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
1-2 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
html, markdown, typescript
Lĩnh vực
frontend, web-dev

Hướng nghiên cứu

Tái hiện round trip với HTML inline của h1 và h2, sau đó kiểm tra markdown-serializer.ts, đặc biệt là defaultMarkdownSerializerNodes.heading và customMarkdownSerializerNodes.html_block. Được coi là hoàn thành khi việc chuyển đổi giữa Markdown và Rich Text giữ nguyên cả hai tiêu đề thay vì gộp chúng thành một thẻ không hợp lệ.

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

Mô tả

bug commonmark html

Describe the bug
When multiple heading HTML tags are inlined without a newline at the end of the line, switching between Markdown and Rich Text mode will mangle the resulting headings into a single invalid tag, breaking the output.

To Reproduce
Steps to reproduce the behavior:

In Markdown mode, paste the following HTML into the editor. Ensure there are no newlines.

<h1>Heading1</h1><h2>Heading2</h2>

Switch to Rich Text mode and back to Markdown mode

You'll now see <h1Heading1h1h2>Heading2</h1Heading1h1h2>

Expected behavior
I expect the round-trip to preserve the headings as they were at the start.

Hunches:

When a heading in pure HTML is serialized, if it doesn't have a newline at the end, it goes through the heading: method of defaultMarkdownSerializerNodes in markdown-serializer.ts. If it has a newline at the end, it'll instead go through html_block() of customMarkdownSerializerNodes in the same file.

Screenshots
heading-merge-bug

Desktop (please
complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 103
Ngôn ngữ chính
TypeScript
Star
440
Fork
61
Merge trung bình
4 ngày 3 giờ
Pull request đã merge (30 ngày)
16

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

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 StackExchange/Stacks-Editor

Tất cả issue của StackExchange/Stacks-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.