Don't pillify code blocks (#7861)
* Don't pillify code blocks Signed-off-by: Robin Townsend <robin@robin.town> * Test that pills do not appear in code blocks Signed-off-by: Robin Townsend <robin@robin.town> * Use snapshot instead for test Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
parent
d79d5ceeac
commit
bb79c6086a
3 changed files with 33 additions and 1 deletions
|
@ -44,7 +44,11 @@ export function pillifyLinks(nodes: ArrayLike<Element>, mxEvent: MatrixEvent, pi
|
|||
while (node) {
|
||||
let pillified = false;
|
||||
|
||||
if (node.tagName === "A" && node.getAttribute("href")) {
|
||||
if (node.tagName === "PRE" || node.tagName === "CODE") {
|
||||
// Skip code blocks
|
||||
node = node.nextSibling as Element;
|
||||
continue;
|
||||
} else if (node.tagName === "A" && node.getAttribute("href")) {
|
||||
const href = node.getAttribute("href");
|
||||
const parts = parsePermalink(href);
|
||||
// If the link is a (localised) matrix.to link, replace it with a pill
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue