Code Block Generator

Generate fenced code blocks with syntax highlighting

Free, no signup — generated in your browser, never uploaded.

Code Block Generator

JavaScript5 lines

Code block

Backticks inside the code get a longer fence automatically.

Docs sites — Docusaurus, Nextra, Astro — GitHub ignores these

e.g., 1,3-5 for lines 1, 3, 4, 5

Adds showLineNumbers to the fence

GitHub and GitLab

Prefix removed lines with - and added lines with +. GitHub colors them red and green.

With the blank line GitHub needs after the summary

Saved in this browser
Markdown

Markdown · 7 lines

```javascript
function greet(name) {
  return `Hello, ${name}!`;
}

console.log(greet('World'));
```

Preview

function greet(name) {
  return `Hello, ${name}!`;
}

console.log(greet('World'));
Generated in your browser · 0 bytes uploadedJavaScript5 lines100 charactersGuide

Syntax Highlighting Languages

Markdown code blocks support syntax highlighting for many languages. Simply specify the language after the opening fence:

```javascript
const greeting = 'Hello, World!';
```