fix: Refine code block detection to exclude inline code

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2025-12-03 03:55:18 +00:00
parent b1b2be6080
commit b749e58f62

View File

@@ -60,7 +60,7 @@ function Article({ cache }) {
}; };
const isCodeBlock = (v) => { const isCodeBlock = (v) => {
return v.localName === 'pre' || v.localName === 'code' || (v.firstElementChild && v.firstElementChild.localName === 'code'); return v.localName === 'pre' || (v.localName === 'code' && !v.closest('p'));
}; };
const renderNodes = (nodes, keyPrefix = '') => { const renderNodes = (nodes, keyPrefix = '') => {