Skip to content

convert_md2html: use gitlab api

Mikhail Vanyulin requested to merge gitlab-markdown-converter into master

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">
Edited by Mikhail Vanyulin

Merge request reports