`md2xml` fails on ` ` entities returned by the GitLab Markdown API (non-breaking spaces in source)

Đang mở Phù hợp với người mới
#39 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
documentation

Hướng nghiên cứu

Start in docmaker.GitLab/md2xml, where the issue’s stack trace shows parser.parseString receives the GitLab Markdown API HTML and fails on  . Read the conversion path around that call and check how the XML parser handles HTML entities. Done means converting Markdown containing U+00A0 succeeds without requiring source files to replace it with regular spaces.

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

Mô tả

If the Markdown contains a non-breaking space (U+00A0), the GitLab Markdown API returns it as  . md2xml then parses that HTML with matlab.io.xml.dom.Parser, which only recognizes XML's built-in entities, so parsing fails.

Reproduction Steps:
>> f = websave(fullfile(tempdir, "MATLAB_DocMaker.mltbx"), ...
               "https://github.com/mathworks/docmaker/releases/download/v0.8.0/MATLAB_DocMaker.mltbx");
>> matlab.addons.install(f);

>> setenv("DOCMAKER_CONVERTER", "GitLab") % with GitLab token configured
>> setenv("DOCMAKER_GITLAB_HOSTNAME", "gitlab.mathworks.com")

>> docmaker.converter().md2xml("a" + char(160) + "b")
Error using matlab.io.xml.dom.Parser/parseString
Unable to parse string: "<div><p data-sourcepos="1:1-1:4" dir="auto">a&nbsp;b</p></div>". Reason: entity 'nbsp' not found.

Error in docmaker.GitLab/md2xml (line 92)
            doc = parser.parseString( "<div>" + xml + "</div>" );
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Current Workaround:

Replace U+00A0 with regular spaces in the .md sources before converting.

Ngôn ngữ chính
MATLAB
Star
10
Fork
3
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 mathworks/docmaker

Tất cả issue của mathworks/docmaker

Issue tương tự

Thêm issue về MATLAB

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.