forked from tanner/qotnews
fix: Extend direct HTML rendering to math elements
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -5,6 +5,7 @@ import localForage from 'localforage';
|
||||
import { sourceLink, infoLine, ToggleDot } from './utils.js';
|
||||
|
||||
const VOID_ELEMENTS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
||||
const DANGEROUS_TAGS = ['svg', 'math'];
|
||||
|
||||
function Article({ cache }) {
|
||||
const { id } = useParams();
|
||||
@@ -106,7 +107,7 @@ function Article({ cache }) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (v.localName === 'svg') {
|
||||
if (DANGEROUS_TAGS.includes(v.localName)) {
|
||||
return <span key={key} dangerouslySetInnerHTML={{ __html: v.outerHTML }} />;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user