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

Not displaying parser errors in rendered markdown #316

Open
kebr0m opened this issue Mar 29, 2024 · 0 comments
Open

Not displaying parser errors in rendered markdown #316

kebr0m opened this issue Mar 29, 2024 · 0 comments

Comments

@kebr0m
Copy link

kebr0m commented Mar 29, 2024

So I'm currently using nextjs and when something that should cause an error in the users markdown string is typed, it displays an error in the browser console, but doesn't display it in the rendered mathpix md, instead it omits the section causing the error from being rendered,

For example if this is the users md string:

image

we see the following log in the console:
image

and this is what is rendered:
image

what should be rendered is:
image

import * as React from 'react';
import { MathpixMarkdown, MathpixLoader, optionsMathpixMarkdown, ParserErrors, TOutputMath } from 'mathpix-markdown-it';

export default function MathpixRenderer({
  equation,
  onDoubleClick,
}: Readonly<{
  equation: string;
  inline: boolean;
  onDoubleClick: () => void;
}>): JSX.Element {
  const markdownOptions: optionsMathpixMarkdown = {
    alignMathBlock: 'center',
    showTimeLog: true,
    isDisableFancy: false,
    htmlTags: true,
    xhtmlOut: false,
    breaks: true,
    typographer: true,
    linkify: true,
    width: 1200,
    codeHighlight: {
      auto: true,
      code: true,
    },
    parserErrors: ParserErrors.show // Adjusted to use ParserErrors enum
  };

  return (
    <div onDoubleClick={onDoubleClick} style={{ cursor: 'pointer' }}>
      <MathpixLoader>
        <MathpixMarkdown text={`${equation}`} {...markdownOptions} />
      </MathpixLoader>
    </div>
  );
}
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