fix(core/link-to-dfn): recognize code dfns with empty text nodes#5239
fix(core/link-to-dfn): recognize code dfns with empty text nodes#5239marcoscaceres wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates core/link-to-dfn’s “is this dfn code?” detection so <dfn> elements whose only meaningful child is <code> (but that also contain whitespace-only text nodes) are treated as code, enabling the requested <dfn>\thing`` authoring pattern.
Changes:
- Filter out whitespace-only text nodes from a
<dfn>’schildNodesbefore determining whether it contains exactly one<code>child. - Adjust the “single child” check to use the filtered node list.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed? |
All reviewer feedback has been addressed in e8bead4:
|
…t nodes Enables <dfn>`term`</dfn> to auto-wrap [=term=] links in <code>. Inlines.js processes backticks before dfn.js, leaving empty text nodes around the <code>. The isCode() check now filters these out. Closes #3346
Address Copilot review feedback: - Check child.nodeType === ELEMENT_NODE before accessing localName, preventing incorrect cast on non-element nodes (Text, Comment). - Add regression test for <dfn> with whitespace text nodes around <code>.
e8bead4 to
c85674c
Compare
|
@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed? |
All feedback has been addressed in e8bead4:
Nothing remains unaddressed. |
Closes #3346