Skip to content

Not displaying parser errors in rendered markdown #316

@kebr0m

Description

@kebr0m

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions