Markdown 代码块语言对照表(博客版)

Markdown 代码块语言对照表(博客版)

内容类型 示例场景 博客应使用的代码块标记
纯文本 / 链接 / API 地址 / 无格式内容 普通文本、说明文字 ```plaintext
TXT 文本 txt 文件、日志输出 ```text
Linux 命令 apt、systemctl、wget、curl ```bash
Shell 脚本 .sh 脚本 ```shell
Zsh 脚本 oh-my-zsh、zsh 配置 ```zsh
OpenWRT 配置 /etc/config/network ```conf
Linux 配置文件 sysctl、fstab、hosts ```conf
Nginx 配置文件 nginx.conf、反代配置 ```nginx
Apache 配置文件 httpd.conf、vhost ```apache
Dockerfile Docker 镜像构建 ```dockerfile
Docker Compose docker-compose.yml ```yaml
YAML 配置文件 Clash、GitHub Actions ```yaml
TOML 配置文件 Cargo.toml、配置文件 ```toml
JSON 配置文件 package.json、API 数据 ```json
XML 配置文件 AndroidManifest.xml ```xml
INI 配置文件 .ini、Windows 配置 ```ini
ENV 环境变量 .env 文件 ```dotenv
Python 代码 .py 脚本、Python 程序 ```python
JavaScript / JS 脚本 .js 文件、Worker 脚本 ```javascript
TypeScript .ts 文件 ```typescript
Node.js 代码 Express、Node 程序 ```javascript
React JSX React 页面 ```jsx
React TSX React + TS 页面 ```tsx
Vue 单文件组件 .vue 文件 ```vue
HTML 网页代码 .html 文件、网页结构 ```html
CSS 样式代码 .css 文件 ```css
SCSS / Sass .scss 文件 ```scss
Less 样式 .less 文件 ```less
PHP 代码 WordPress、PHP 网站 ```php
Java 代码 SpringBoot、Java 程序 ```java
Kotlin 代码 Android 开发 ```kotlin
Go 代码 Golang 程序 ```go
Rust 代码 Rust 程序 ```rust
C 语言 .c 文件 ```c
C++ 代码 .cpp 文件 ```cpp
C# 代码 .cs 文件 ```csharp
Swift 代码 iOS 开发 ```swift
Dart 代码 Flutter 开发 ```dart
Lua 脚本 OpenResty、游戏脚本 ```lua
Perl 脚本 Perl 程序 ```perl
Ruby 代码 Ruby on Rails ```ruby
SQL 数据库语句 MySQL、PostgreSQL ```sql
Redis 配置 redis.conf ```conf
Makefile make 编译文件 ```makefile
Git Diff 对比 补丁、修改内容 ```diff
Git Commit 提交记录 ```git
Powershell 脚本 Windows 自动化 ```powershell
Windows BAT 脚本 .bat 文件 ```bat
CMD 命令 Windows cmd ```cmd
注册表文件 Windows 注册表 ```reg
Nginx Rewrite 规则 URL 重写 ```nginx
Cloudflare Worker Worker JS 脚本 ```javascript
Terraform 配置 IaC 配置 ```hcl
Kubernetes YAML K8s 部署文件 ```yaml
GitHub Actions CI/CD 工作流 ```yaml
Ansible Playbook 自动化运维 ```yaml
Mermaid 流程图 graph TD 图表 ```mermaid
Mermaid 时序图 sequenceDiagram ```mermaid
Mermaid 甘特图 gantt 图 ```mermaid
LaTeX 数学公式 数学表达式 ```latex
Markdown 示例 Markdown 教程 ```markdown
日志文件 系统日志、输出 ```log
CSV 数据 表格数据 ```csv
Excel 导出数据 表格内容 ```csv
DNS Zone 配置 Bind、域名解析 ```dns
SSH Config ~/.ssh/config ```ssh-config
Vim 配置 .vimrc ```vim
Emacs 配置 .emacs ```lisp
正则表达式 Regex 示例 ```regex
ASCII 图 文本图形 ```text
Hex 数据 十六进制数据 ```hex
protobuf 定义 .proto 文件 ```proto
GraphQL 查询 gql 请求 ```graphql
Arduino 代码 单片机程序 ```cpp
NFO 文件 ASCII 信息文件 ```text

示例

Linux 命令

1
2
3
```bash
apt update
apt install nginx -y