How to allow HTML attribute with namespace using filter One of the analytics providers requires all the links to have a specific attribute sc:linkname to track details. Drupal 8 filter works for linkname but not with sc: prefix. From  https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 it looks like all attributes have default namespace (e.g. href => xlink:href).
One way to solve this problem is to have a custom filter which processes the linkname and convert to sc:linkname.

&lt;?php

namespace Drupal\my_module\Plugin\Filter;

use Drupal\Component\Utility\Html;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;

/**
 * Provides a filter to correct faulty and chopped off HTML.
 *
 * @Filter(
 *   id = "filter_html_attribute_namespace_fixer",
 *   title = @Translation("Add 'sc' namespace to HTML attribute 'linkname'"),
 *   type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE,
 *   weight = 10
 * )
 */
class FilterHtmlAttributeNamespaceCorrector extends FilterBase {

  /**
   * {@inheritdoc}
   */
  public function process($text, $langcode) {
    return new FilterProcessResult($this-&gt;addNamespace($text));
  }

  protected function addNamespace($text, $namespace = 'sc') {
    $html_dom = Html::load($text);
    $xpath = new \DOMXPath($html_dom);
    foreach ($xpath-&gt;query('//a[@*]') as $element) {
      foreach ($element-&gt;attributes as $name =&gt; $attribute) {
        if ($name == 'linkname') {
          $element-&gt;setAttribute('sc:linkname', $attribute-&gt;value);
          $element-&gt;removeAttribute($name);
        }
      }
    }
    $text = Html::serialize($html_dom);
    return trim($text);
  }

}