diff --git a/webclient/src/Article.js b/webclient/src/Article.js index 2583a99..b2f3a20 100644 --- a/webclient/src/Article.js +++ b/webclient/src/Article.js @@ -57,6 +57,10 @@ function Article({ cache }) { setPConv(prevPConv => [...prevPConv, n]); }; + const isCodeBlock = (v) => { + return v.localName === 'pre' || v.localName === 'code' || (v.children?.length === 1 && v.children[0].localName === 'code'); + }; + const nodes = useMemo(() => { if (story && story.text) { let div = document.createElement('div'); @@ -105,7 +109,7 @@ function Article({ cache }) { : - {(v.localName === 'pre' || v.localName === 'code' || (v.children?.length === 1 && v.children[0].localName === 'code')) && } + {isCodeBlock(v) && } ) )}