Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 147x 32x 32x 32x 32x 2x 30x 30x | export default function parseAnchor(text: string): string[] {
const div = document.createElement('div');
div.innerHTML = text;
const anchor = div.querySelector('a');
if (!anchor) {
return [];
}
const anchorSiblings = div.innerHTML.split(anchor.outerHTML);
return [ anchorSiblings[0], anchor.text, anchorSiblings[1] ];
}
|