MediaWiki Wikitext
Generate and edit content using MediaWiki's wikitext markup language.
Quick Reference
Text Formatting
CODEBLOCK0
Headings (line start only, avoid level 1)
CODEBLOCK1
Lists
CODEBLOCK2
Links
CODEBLOCK3
Table
CODEBLOCK4
Templates & Variables
CODEBLOCK5
References
CODEBLOCK6
Special Tags
CODEBLOCK7
Magic Words
CODEBLOCK8
Common Patterns
Article Structure
CODEBLOCK9
Template Definition
CODEBLOCK10
Key Syntax Rules
- 1. Headings: Use
== to ======; don't use = (reserved for page title) - Line-start markup: Lists (
*#;:), headings, tables ({|) must start at line beginning - Closing tags: Close heading equals on same line; no text after closing INLINECODE5
- Blank lines: Create paragraph breaks; single newlines are ignored
- Pipes in templates: Use
{{!}} for literal | inside templates - Escaping: Use
<nowiki> to escape markup; & for &, < for INLINECODE12
Resources
For detailed syntax, see:
- - references/syntax.md: Complete markup reference with all options
- references/templates.md: Template and parser function details
- assets/snippets.yaml: Editor snippets for common patterns
MediaWiki Wikitext
使用MediaWiki的wikitext标记语言生成和编辑内容。
快速参考
文本格式
wikitext
斜体 粗体 粗斜体
行内代码 下标 上标
删除线 下划线
标题(仅限行首,避免使用一级标题)
wikitext
== 二级标题 ==
=== 三级标题 ===
==== 四级标题 ====
列表
wikitext
嵌套列表项 ## 嵌套列表项 : 定义
链接
wikitext
[[页面名称]] 内部链接
[[页面名称|显示文本]] 带显示文本
[[页面名称#章节]] 章节链接
[https://网址 显示文本] 外部链接
[[File:图片.jpg|thumb|说明]] 图片
[[Category:分类名称]] 分类(置于末尾)
表格
wikitext
{| class=wikitable
|+ 标题
|-
! 表头1 !! 表头2
|-
| 单元格1 || 单元格2
|}
模板与变量
wikitext
{{模板名称}} 基本调用
{{模板名称|参数1|名称=值}} 带参数
{{{参数|默认值}}} 参数(在模板内)
{{PAGENAME}} {{CURRENTYEAR}} 魔术字
参考文献
wikitext
文本
[引用内容]
[引用] 命名引用
重复使用引用
{{Reflist}} 显示脚注
特殊标签
wikitext
[[已转义]] 禁用标记
预格式化块
预格式化(无标记)
代码高亮
代码内容
LaTeX数学公式
注释(隐藏)
---- 水平分割线
#REDIRECT [[目标页面]] 重定向(仅限首行)
魔术字
wikitext
NOTOC 隐藏目录
TOC 在此处放置目录
NOEDITSECTION 隐藏章节编辑链接
常见模式
文章结构
wikitext
{{信息框类型
| 名称 = 示例
| 图片 = 示例.jpg
}}
文章标题是简要介绍。
== 章节 ==
带引用的内容[来源]。
=== 子章节 ===
更多内容。
== 参见 ==
== 参考文献 ==
{{Reflist}}
== 外部链接 ==
- * [https://example.com 官方网站]
{{DEFAULTSORT:排序键}}
[[Category:分类名称]]
模板定义
wikitext
{{文档}}
{| class=wikitable
! {{{标题|默认标题}}}
|-
| {{{内容|未提供内容}}}
{{#if:{{{页脚|}}}|
{{!}}-
{{!}} {{{页脚}}}
}}
|}
关键语法规则
- 1. 标题:使用==到======;不要使用=(保留给页面标题)
- 行首标记:列表(*#;:)、标题、表格({|)必须从行首开始
- 闭合标签:标题等号在同一行闭合;闭合==后不能有文本
- 空行:创建段落分隔;单个换行会被忽略
- 模板中的管道符:在模板内使用{{!}}表示字面|
- 转义:使用转义标记;&表示&,<表示<
资源
有关详细语法,请参见:
- - references/syntax.md:包含所有选项的完整标记参考
- references/templates.md:模板和解析器函数详情
- assets/snippets.yaml:常见模式的编辑器代码片段