(node: Element)
| 35 | /* textContent, not innerText: innerText needs layout, which jsdom has none of, |
| 36 | and the collapsed whitespace is what a card wants anyway. */ |
| 37 | const text = (node: Element) => { |
| 38 | const clone = node.cloneNode(true) as Element; |
| 39 | |
| 40 | clone |
| 41 | .querySelectorAll(BRIEF_SOURCE_LINK_SELECTOR) |
| 42 | .forEach((link) => link.remove()); |
| 43 | |
| 44 | return (clone.textContent ?? '').replace(/\s+/g, ' ').trim(); |
| 45 | }; |
| 46 | |
| 47 | /** |
| 48 | * The section a heading opens, up to the next heading of any level. Matching is |
no test coverage detected