Indented code blocks
This is an example of a code block created by indenting all lines by four spaces.
public static void main(String[] args) {
System.out.println("This is a java code block");
}
Fenced code blocks
This is an example of a fenced code block that specifies Java syntax highlighting.
public class Hello {
public static void main(String arg[]) {
System.out.println("Hello.");
}
}
This is an example of a fenced code block that specifies no syntax highlighting.
public class Hello {
public static void main(String arg[]) {
System.out.println("Hello.");
}
}
Terminal code
This is an example of terminal code styling for a single command.
ls
This is an example of terminal code styling for a multi-line command.
multi \
line
This is an example of terminal code styling for multiple commands.
first command
second command
Markdown and HTML syntax in code blocks
The following is a Markdown code block that displays Markdown syntax:
You can use **bold** or *italics* in Markdown.
The following is a Markdown code block that displays HTML syntax:
You can use <strong>bold</strong> or <em>italics</em> in HTML.
Click-to-copy
Disabling click-to-copy on a code block
This rendered code block doesn't have a click-to-copy button.
Click-to-copy analytics events
This click-to-copy button has a unique analytics event label.
Click-to-copy and accessibility
This click-to-copy button has a unique label.