Code
Code blocks with syntax highlighting and line numbers
Code blocks with syntax highlighting.
Line numbers/highlights are supported:
```tsx {1,4-6} showLineNumbers
type Props = {who: string}
function Hi({who}: Props) {
return (
<p>Hello, {who}!</p>
)
}
```
result:
type Props = {who: string}
function Hi({who}: Props) {
return (
<p>Hello, {who}!</p>
)
}
You can start at a specific X line number showLineNumbers=X:
```tsx {1,4-6} showLineNumbers=150
type Props = {who: string}
function Hi({who}: Props) {
return (
<p>Hello, {who}!</p>
)
}
```
result:
type Props = {who: string}
function Hi({who}: Props) {
return (
<p>Hello, {who}!</p>
)
}
diff format is supported:
```diff
diff --git a/example.txt b/example.txt
index 8c3317a..47ea956 100644
--- a/example.txt
+++ b/example.txt
@@ -1,4 +1,4 @@
-Hello, World!
+Hello, GitHub World!
Here are some changes:
-This line will be modified.
+This line has been modified.
This line will stay the same.
```
result:
diff --git a/example.txt b/example.txt
index 8c3317a..47ea956 100644
--- a/example.txt
+++ b/example.txt
@@ -1,4 +1,4 @@
-Hello, World!
+Hello, GitHub World!
Here are some changes:
-This line will be modified.
+This line has been modified.
This line will stay the same.