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

Aperta Adatta ai principianti
#39 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Ambito
documentation

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
MATLAB
Stelle
10
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mathworks/docmaker

Tutte le issue di mathworks/docmaker

Issue simili

Altre issue su MATLAB

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.