convert_md2html: use gitlab api
This is a fix for issue [746-001267] CI: Markdown to html conversion with gitlab flavor
The essence of work is in following adjustments for convert_md2html.py:
- to work with "gitlab" python module;
- and to use gitlab API for markdown to html conversion. Herewith a "Render text using GitLab Flavored Markdown" parameter is set to "True".
Results:
- Example of output produced by new convert_md2html.py executed by part of "build-documentation" job in Gitlab: https://git.seco.com/seco-ne/yocto/manifest/-/jobs/786616
- Here is an archive with artifacts from old script and from new script:md2html.tgz where "new" directory contains the output of the new script; and “old" - from the old one.
Notes:
- I`ve noticed that although
[[TOC]]
in "hints.md" got converted by the new script, hyperlinks in it do not work. Plus "hints.md" in general was parsed differently that with the old script. - In the last change to this MR, I`ve added "project" parameter to "markdown" call (the one, that generates html). Exempt from documentation:
markdown(text: str, gfm: bool = False, project: str | None = None, **kwargs: Any)
project (str | None) – Full path of a project used a context when gfm is True
As a side effect, additional data fields are added to the links in output changelog.html.
With this change a following additional information is added to the links, pointing to MRs:
<data-reference-type="merge_request" data-original="!187" data-link="true" data-link-reference="true" data-project="2074" data-merge-request="4977" data-project-path="seco-ne/yocto/layers/meta-seconorth-machine" data-iid="187" data-container="body" data-placement="top" title="overrides: Run automated conversion of OVERRIDES" class="gfm gfm-merge_request">
Merge request reports
Activity
assigned to @mikhail.vanyulin
requested review from @jonas.hoeppner
- Resolved by Jonas Höppner
Hi Mikhail,
It is strange, that the links from the TOC are not working. From a first look, the html looks valid to me. Could you dig a little further whats wrong here? May be the custom CSS header breaks something here? The layout is old anyway and also needs to be tweaked.
For the general rendering result, this README https://git.seco.com/seco-ne/yocto/custom/pbb/manifest#adi-interface with the formulas would be interessting, as it was rendered wrong with the old renderer.
When I compare the hints in the new and the old rendering, some problems are already gone. See bluetooth section here http://support.garz-fricke.com/projects/Linux-Yocto/Releases/Yocto-kirkstone-17.0/hints.html compared with the new. That's good, at least.