mathpix-markdown-it icon indicating copy to clipboard operation
mathpix-markdown-it copied to clipboard

Not displaying parser errors in rendered markdown

Open kebr0m opened this issue 1 year ago • 0 comments

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>
  );
}

kebr0m avatar Mar 29 '24 17:03 kebr0m