Skip to content

GitLab Next

    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Menu
    Projects Groups Snippets
  • Get a free trial
  • Sign up
  • Login
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 43,111
    • Issues 43,111
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,371
    • Merge requests 1,371
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLabGitLab
  • Issues
  • #20857
Closed
Open
Created Jan 28, 2018 by Tobias@tobago

Allow rel="license" microformat in Redcarpet/GFM sanitization so that machine-readable Creative Commons attribution in md documents is made possible

Description

Starting at: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#inline-html

Right now, when pushing .md files to GitLab CE, links that include Creative Commons (CC)-style license attribution inside this md file (with rel="license"-microformat) are automatically sanitized and rendered as rel="nofollow noreferrer noopener". Hence, the "license" information relevant for schema.org metadata handling becomes lost.

Problem: No option to include rel="license" microformat attribute in GitLab-flavored Markdown (GFM).

Use Case: When creating .md documents of any sort that references open content published under anything more restrictive than CC0/Public Domain, this content ought to be attributed properly. Best-practice denotes an inclusion of machine-readable license attribution, which is commonly realized via the rel="license"-microformat attribute.


Example 1 (raw CC-BY HTML)

original license attribution text gathered from CC

<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.

gets sanitized and rendered to:

<p dir="auto"><a href="http://creativecommons.org/licenses/by/4.0/" rel="nofollow noreferrer noopener" target="_blank"><img alt="Creative Commons License" src="https://i.creativecommons.org/l/by/4.0/88x31.png" class="js-lazy-loaded"></a><br>This work is licensed under a <a href="http://creativecommons.org/licenses/by/4.0/" rel="nofollow noreferrer noopener" target="_blank">Creative Commons Attribution 4.0 International License</a></p>

rel="license" removed


Example 2 (CC-BY markdown)

![Creative Commons License](https://i.creativecommons.org/l/by/4.0/88x31.png) This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).

no option to adress rel="license" directly

is rendered

<p dir="auto"><a class="no-attachment-icon" href="https://i.creativecommons.org/l/by/4.0/88x31.png" target="_blank" rel="nofollow noreferrer noopener"><img src="https://i.creativecommons.org/l/by/4.0/88x31.png" alt="Creative Commons License" class="js-lazy-loaded"></a> This work is licensed under a <a href="http://creativecommons.org/licenses/by/4.0/" rel="nofollow noreferrer noopener" target="_blank">Creative Commons Attribution 4.0 International License</a>.</p>

Proposal

Include rel="license" into the extended GFM sanitization filter, so that raw HTML can retain this part.

Documentation reads:

In addition to the default SanitizationFilter whitelist, GitLab allows span, abbr, details and summary elements.

Add href rel="license" to GitLab's extended GFM whitelist. If rel="license" is part of original HTML, it should not be sanitized/cleared during markdown rendering.

Links / references

  • https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#inline-html
  • referring to: http://www.rubydoc.info/gems/html-pipeline/1.11.0/HTML/Pipeline/SanitizationFilter#WHITELIST-constant

//label ~"feature proposal"

Edited Aug 14, 2020 by 🤖 GitLab Bot 🤖
Assignee
Assign to
Time tracking