Code
Display code snippets in your documentation using standard markdown code blocks (triple backticks) with syntax highlighting and advanced features.
Syntax
Use triple backticks with a language identifier:
```javascript
const greeting = "Hello World";
console.log(greeting);
```
Supported Languages
The following language identifiers are supported for syntax highlighting:
bash, c, cpp, csharp, css, git, go, graphql, http, java, javadoc, javascript, jsdoc, json, json5, jsx, less, markdown, markup, objectc, php, python, regex, rest, sass, sql, typescript, xml-doc, yaml
Advanced Features
Line Highlighting
Highlight specific lines using data-line:
```javascript-data-line="2,4"
function example() {
const x = 1; // Highlighted
const y = 2;
return x + y; // Highlighted
}
```
function example() {
const x = 1; // Highlighted
const y = 2;
return x + y; // Highlighted
}
Disable Line Numbers
Remove line numbers for cleaner display using disableLineNumbers:
```bash-disableLineNumbers
npm install
npm start
```
npm install
npm start
Examples
See detailed examples and use cases:
- Basic Code Blocks - Simple code examples
- Highlighted Lines - Specific line highlighting examples
- Code in Lists - Code blocks nested in lists
- Code in Tables - Inline code in table cells
- Combined Features - Multiple features together