Skip to content

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

//label ~"feature proposal"

Edited by 🤖 GitLab Bot 🤖