Browse Source

update is highlighted by elasticsearch

ryoji-s 3 years ago
parent
commit
27a47db638

+ 2 - 1
packages/app/src/components/ReactMarkdownComponents/CodeBlock.tsx

@@ -9,7 +9,8 @@ import styles from './CodeBlock.module.scss';
 export const CodeBlock: CodeComponent = ({ inline, className, children }) => {
 export const CodeBlock: CodeComponent = ({ inline, className, children }) => {
 
 
   const isHighlightedByElasticsearch = useMemo((): boolean => {
   const isHighlightedByElasticsearch = useMemo((): boolean => {
-    return !(children.every(item => typeof item === 'string') && children.length === 1);
+    const hasOnlyOneStringChild = children.length === 1 && typeof children[0] === 'string';
+    return !hasOnlyOneStringChild;
   }, [children]);
   }, [children]);
 
 
   if (inline) {
   if (inline) {