Skip to content

Convert Markdown to HTML with GitLab #15

@k-deeley

Description

@k-deeley

Nice alternative, also allows private conversion.

https://docs.gitlab.com/ee/api/markdown.html#render-an-arbitrary-markdown-document

This works:

request = matlab.net.http.RequestMessage( method, [], struct( "text", md, "gfm", true ) );
request = addFields( request, "Content-Type", "application/json" );
request = addFields( request, "PRIVATE-TOKEN", getSecret("GitLab API token") );
uri = matlab.net.URI( "https://insidelabs-git.mathworks.com/api/v4/markdown" );
response = request.send( uri );

It's not possible to create a "just authenticate" token in GitLab. I don't know what is the lowest set of permissions that will work.

Looks like "API" which is everything the user can do.

Differences between GitLab and GitHub returned HTML:

  • GitLab MATLAB blocks are in: <pre data-sourcepos="34:1-36:3" data-canonical-lang="matlab" class="code highlight js-syntax-highlight language-matlab" lang="matlab" v-pre="true"> in <div class="gl-relative markdown-code-block js-markdown-code">
  • Some emojis don't convert, e.g., 🦛 😞

Otherwise the styling is clean. When the GitHub CSS is applied, everything except syntax highlighting looks the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions