highlight.js
highlight.js copied to clipboard
R — The first number is not getting the hljs-number class
Describe the issue
When the number is next to the <- operator, it doesn't get highlighted. It isn't getting the hljs-number class.
Which language seems to have the issue? R.
Are you using highlight or highlightAuto?
highlight
...
Sample Code to Reproduce
import hljs from 'highlight.js/lib/core'
import r from 'highlight.js/lib/languages/r'
import 'highlight.js/styles/agate.css'
hljs.registerLanguage('r', r)
export default function RCode({ content }: { content: string }) {
const highlightedCode = hljs
.highlight(content, { language: 'r' })
.value
return
<pre className={className}>
<code dangerouslySetInnerHTML={{ __html: highlightedCode }} />
</pre>
}
The content prop is coming from an MDX file. I'm using Next.js (React) and next-mdx-remote/rsc, using the compileMDX function.
Expected behavior All numbers should be highlighted and have the hljs-number class.
Please provide actual R source, not just a graphic.