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

Cannot render markdown while using library with ReactMarkdown #15

Open
seppar93 opened this issue May 4, 2020 · 1 comment
Open

Cannot render markdown while using library with ReactMarkdown #15

seppar93 opened this issue May 4, 2020 · 1 comment

Comments

@seppar93
Copy link

seppar93 commented May 4, 2020

Currently, my application uses the ReactMarkdown package to display my text and I've tried to embed my it with mathjax however cannot have everything displayed properly.
also using import RemarkMathPlugin from 'remark-math' to parse math from text

    ...props,
    plugins: [RemarkMathPlugin],
    renderers: {
      ...props.renderers,
      math: props => <MathJax.Text inline />,
      inlineMath: props => <MathJax.Text inline />
    }
  };
  return (
    <div className='QDocMarkdownComponent'>
      <MathJax.Context
        input='ascii'
        onLoad={() => console.log('Loaded MathJax script!')}
        onError={(MathJax, error) => {
          console.warn(error);
          console.log('Encountered a MathJax error, re-attempting a typeset!');
          MathJax.Hub.Queue(MathJax.Hub.Typeset());
        }}
        script='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=AM_HTMLorMML'
        options={{
          asciimath2jax: {
            useMathMLspacing: true,
            delimiters: [['$$', '$$']],
            preview: 'none'
          }
        }}>
        <ReactMarkdown escapeHtml={false} {...newProps} />
      </MathJax.Context>
    </div>
  );```
@ProfessorX737
Copy link

Try

math: props => <MathJax.Node>{props.value}</MathJax.Node>,
inlineMath: props => <MathJax.Node inline>{props.value}</MathJax.Node>,

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

2 participants