remarkjs/remark-math

The dollar sign is not showing in single $ quote

jackykwandesign opened this issue · 6 comments

Initial checklist

Affected packages and versions

"rehype-katex": "^6.0.2",     "remark-math": "^5.1.1",

Link to runnable example

No response

Steps to reproduce

Markdown viewer, children is just the markdown text

import ReactMarkdown from "react-markdown";
import remarkMath from "remark-math";
import rehypeKatex from "rehype-katex";
import "katex/dist/katex.min.css"; // `rehype-katex` does not import the CSS for you

<ReactMarkdown
	remarkPlugins={[remarkMath]}
	rehypePlugins={[rehypeKatex]}
>
	{props.children}
</ReactMarkdown>

Expected behavior

give

$$
\$10
$$

or

$
\$10
$

will show

$10

Actual behavior

Only double $$ sign quote can show correct dollar currency symbol, single quote can't show

image

Runtime

Node v16

Package manager

yarn 2

OS

Linux

Build and bundle tools

Create React App

This is intentional behavior. The same occurs for code.

```
`10
```
`10
`
`10
`

10
`

Hey! I am also seeing this behavior. Is there a way to render dollar signs in inline-mode or am I SOL?

Yes there is. Just like with code, use more dollars.

Aaa $$ math $ also math $$ bbb

actually i found lib https://www.npmjs.com/package/markdown-it-katex in markdown-it eco is supporting inline dollar sign with $ \$123 $ format, and tools such asNotions is following this convention

image

so maybe current behavior is not convenience and not compatible

wooorm commented

There is no spec, no two tools are going to be the same.
The smartest thing to do then, is to stick to markdown, in this case, how code works. And that’s what we do.

seems it is underlayer difference between pandoc and commonmark, they treat single dollar sign differently