为 100 多种编程语言提供适当格式和语法高亮的代码展示。
用反引号(`)包裹文本,将其格式化为句子中的行内代码。
Use code for inline code snippets.
The console.log() function prints to the console.
Install with npm install package-name.
在单独的行上使用三个反引号(```)创建围栏代码块。
function hello() {
return "Hello, World!"
}在开头的反引号后添加语言标识符以启用语法高亮。
javascript
const greeting = "Hello, Markdown!"
console.log(greeting)python
def greet(name):
return f"Hello, {name}!"通过将每行缩进至少四个空格或一个制表符来创建代码块。通常更推荐使用围栏代码块。
// Indented with 4 spaces
const x = 42
console.log(x)