Skip to content

Commit 1b0ad39

Browse files
Copilotphieri
andauthored
Skip call sign auto-detection inside code and pre elements (#28)
* Initial plan * Skip call sign auto-detection inside code and pre elements Agent-Logs-Url: https://github.com/phieri/callsign.js/sessions/065dc63f-540e-41b2-bf49-ee07d2ecfa63 Co-authored-by: phieri <12006381+phieri@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: phieri <12006381+phieri@users.noreply.github.com>
1 parent 615a823 commit 1b0ad39

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/callsign.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,13 @@ class Callsign extends HTMLElement {
389389
NodeFilter.SHOW_TEXT,
390390
{
391391
acceptNode(node) {
392-
// Skip script and style elements
392+
// Skip script, style, code and pre elements
393393
const parent = node.parentElement;
394394
if (!parent || parent.tagName === 'SCRIPT' ||
395395
parent.tagName === 'STYLE' ||
396-
parent.tagName === 'CALL-SIGN') {
396+
parent.tagName === 'CALL-SIGN' ||
397+
parent.tagName === 'CODE' ||
398+
parent.tagName === 'PRE') {
397399
return NodeFilter.FILTER_REJECT;
398400
}
399401
// Only accept nodes with potential call signs

0 commit comments

Comments
 (0)