react-native-htmlview
react-native-htmlview copied to clipboard
can add katex css to this html view ?
katex css to this html view ? any kind of help thanks
i use react native math view component to render latex in my html view
import React from 'react'; import { View, useWindowDimensions } from 'react-native'; import MathView from 'react-native-math-view' import HTMLView from 'react-native-htmlview'; import { parseLatexInHTML } from './lib';
const NativeHTMLnTEXView = ({ defaultTextProps, source, delimiters }) => { const { html } = source;
if (!delimiters) delimiters = [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
];
const parsed = parseLatexInHTML(html, { ...delimiters, throwOnError : false });
const renderNode = (node, index, siblings, parent, defaultRenderer) => {
if (node.name == 'math') {
return (
<View key={index} >
<MathView math={node.children[0].data} />
</View>
);
}
}
return (
<HTMLView value={`<div>${parsed}<div>`} renderNode={renderNode} />
)
};