Skip to content

Parse errors occur on formulas with remark-math #576

Closed
@r4ai

Description

@r4ai

Initial checklist

Affected package

eslint-plugin-mdx@3.4.1

Steps to reproduce

A minimal and reproducible repository is available here:

https://github.com/r4ai/eslint-plugin-mdx-math-issue

Actual behavior

I added remark-math to the plugins array in .remarkrc.js as shown below, but the parse error still persists.

.remarkrc.js:

import remarkPresetLintConsistent from "remark-preset-lint-consistent";
import remarkPresetLintRecommended from "remark-preset-lint-recommended";
import remarkMath from "remark-math";
import remarkPresetLintMarkdownStyleGuide from "remark-preset-lint-markdown-style-guide";
import remarkPresetPrettier from "remark-preset-prettier";

export default {
  plugins: [
    remarkMath,
    remarkPresetLintConsistent,
    remarkPresetLintRecommended,
    remarkPresetLintMarkdownStyleGuide,
    remarkPresetPrettier,
  ],
};

math.mdx:

$$
\forall \epsilon > 0, \exists \delta > 0 \text{ s.t. } |x - a| < \delta \Rightarrow |f(x) - b| < \epsilon
$$
$ bun run eslint .

/home/r4ai/src/repos/github.com/r4ai/eslint-plugin-mdx-math/src/math.mdx
  0:54  error  Preprocessing error: Could not parse expression with acorn

✖ 1 problem (1 error, 0 warnings)

Expected behavior

Parse normally

Runtime

node@22.15.0

bun@1.2.11

Package manager

bun@1.2.11

Operating system

Ubuntu 24.04.2 LTS

Build and bundle tools

No response

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