Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to Rendering with math Equation #224

Open
pmathpal opened this issue Aug 20, 2024 · 0 comments
Open

how to Rendering with math Equation #224

pmathpal opened this issue Aug 20, 2024 · 0 comments

Comments

@pmathpal
Copy link

i want render with mathematical expressions. my code is like this and i am using react-native-mathjax library for mathematical expressions. but its does not work. the rules method is not being called. Please give me how to do this its urgent for me.
const CustomMarkdown = ({ content }) => {
// Define custom rules for rendering math
const customRules = {
inline_math: (node, children, parent, styles) => {
console.log('Inline math node:', node); // Debugging log
const content = node.content.replace(/\(/g, "").replace(/\)/g, "");
return (
<MathJax
key={node.key}
html={<span>\\(${content}\\)</span>}
mathJaxOptions={{
messageStyle: 'none',
}}
/>
);
},
block_math: (node, children, parent, styles) => {
console.log('Block math node:', node); // Debugging log
const content = node.content.replace(/\[/g, "").replace(/\]/g, "");
return (
<MathJax
key={node.key}
html={<div>\\[${content}\\]</div>}
mathJaxOptions={{
messageStyle: 'none',
}}
/>
);
},
text: (node, children, parent, styles) => {
console.log('Text node:', node); // Debugging log
return <Text style={{ color: 'red' }}>{node.content};
},
};

return (
<ScrollView style={{ padding: 10 }}>


{content}



);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant