blob: 56ad55ef553cdbae54182626fc1a0bd86a93c9af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import { escape } from 'lodash';
import { setAttributes } from '~/lib/utils/dom_utils';
export const createLink = (href, innerText) => {
// eslint-disable-next-line @gitlab/require-i18n-strings
const rel = 'nofollow noreferrer noopener';
const link = document.createElement('a');
setAttributes(link, { href: escape(href), rel });
link.innerText = escape(innerText);
return link.outerHTML;
};
export const generateHLJSOpenTag = (type) => `<span class="hljs-${escape(type)}">"`;
|