UNPKG

@fedify/markdown-it-mention

Version:

A markdown-it plugin that parses and renders Mastodon-style @mentions.

22 lines (21 loc) 759 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isLinkClose = exports.isLinkOpen = void 0; const LINK_OPEN_PATTERN = /^<a[>\s]/i; const LINK_CLOSE_PATTERN = /^<\/a\s*>/i; /** * Tests if the given string is an opening link tag. * @function * @param html The string to test. * @returns `true` if the given string is an opening link tag, * or `false` otherwise. */ exports.isLinkOpen = LINK_OPEN_PATTERN.test.bind(LINK_OPEN_PATTERN); /** * Tests if the given string is a closing link tag. * @function * @param html The string to test. * @returns `true` if the given string is a closing link tag, * or `false` otherwise. */ exports.isLinkClose = LINK_CLOSE_PATTERN.test.bind(LINK_CLOSE_PATTERN);