React + Prism.js highlights automatically after import
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13k
- Forks
- 1.4k
- Avg merge
- 15h 36m
- Merged PRs (30d)
- 3
Description
When I import Prism.js in a React app, Prism.js automatically and immediately hightlights all code blocks.
I want to highlight the code blocks manually.
This is my React app codes:
import React from "react";
import Prism from "prismjs";
import "prismjs/themes/prism-tomorrow.css";
const code = `const App = props => {
return (
<div>
<h1> React App </h1>
<div>Awesome code</div>
</div>
);
};
`;
export default function App() {
return (
<pre>
<code className="language-javascript">{code}</code>
</pre>
);
}
See the live example at Codesandbox
How can I highlight the code block manually?
Note: I've also asked this question on Stackoverflow, but got no answers.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox, especially src/App.js, and reproduce the reported behavior after importing Prism.js. Determine whether the import causes the
block to be highlighted automatically and identify the documented way to request highlighting manually. Done means the example remains unhighlighted until highlighting is explicitly requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100