Languages
[Edit]
EN

Markdown - how to make blocks of React code (syntax highlighting - github, dev.to)

3 points
Created by:
maryam
1181

In this article, we would like to show you how to create blocks of React code with syntax highlighting in markdown.

To create a block of React code with syntax highlighting you need to wrap your code with three backticks (```) and tell markdown it's JSX in the first line right after backticks.

Practical example:

```jsx
import React from "react";

const App = () => {
  return (
    <div>
      <h1>My App</h1>
    </div>
  );
};

export default App;
```

Result from github.com:

Markdown - highlighted React code example on github.com
Markdown - highlighted React code example on github.com

Result from dev.to:

Markdown - highlighted React code example
Markdown - highlighted React code example on dev.to

References

Alternative titles

  1. React - add syntax highlighting for my code in markdown
  2. Markdown - how to highlight React code
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Markdown

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join