编辑“︁
Help:Wikitext
”︁(章节)
跳转到导航
跳转到搜索
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
=={{anchor|Limiting formatting}} Limiting formatting / escaping wiki markup== A few different kinds of formatting will tell the wiki to display things as you typed them – what you see is what you get! {| class="wikitable" style="margin-right:0em;" |- !What you type !What it looks like |- | <pre>'''&lt;nowiki&gt; tag:''' <nowiki> The nowiki tag ignores [[wiki]] ''markup''. It reformats text by removing newlines and multiple spaces. It still interprets characters specified by &name;: &rarr; </nowiki></pre> | '''<nowiki> tag:''' <nowiki> The nowiki tag ignores [[wiki]] ''markup''. It reformats text by removing newlines and multiple spaces. It still interprets characters specified by &name;: → </nowiki> |- | <pre>'''&lt;pre&gt; tag:''' <pre>The <pre> tag ignores [[wiki]] ''markup'' as does the <nowiki> tag. Additionally, <pre> displays in a mono-spaced font, and does not reformat text spaces. It still interprets special characters: &rarr; </pre></pre> | '''<pre> tag:''' <pre>The <pre> tag ignores [[wiki]] ''markup'' as does the <nowiki> tag. Additionally, <pre> displays in a mono-spaced font, and does not reformat text spaces. It still interprets special characters: →</pre> |- | <pre>'''[Text without a URL]:''' Single square brackets holding [text without a HTTP URL] are preserved, but single square brackets containing a URL are treated as being an external [http://example.com/ Web link].</pre> | '''[Text without a URL]:''' Single square brackets holding [text without a HTTP URL] are preserved, but single square brackets containing a URL are treated as being an external [http://example.com/ Web link]. |- | <syntaxhighlight lang="moin">'''Leading space:''' Leading spaces are another way to preserve formatting. Putting a space at the beginning of each line stops the text from being reformatted. It still interprets [[wiki]] ''markup'' and special characters: &rarr;</syntaxhighlight> | '''Leading space:''' Leading spaces are another way to preserve formatting. Putting a space at the beginning of each line stops the text from being reformatted. It still interprets [[wiki]] ''markup'' and special characters: → |} ===無Wiki模式=== {{shortcut|Help:NOWIKI|WP:NOWIKI}} In order for the software to interpret wiki markup, its parser first scans the page. When it sees its nowiki tags :{{tag|nowiki}} ([[escape character|escape]]s all contained wiki markup), and :{{tag|nowiki|s}} (escapes the interpretations it is designed to "break"), it escapes its wikicode, so editors can document its markup ''using'' its markup. Article editors can normalize the font of characters trailing <code>[<nowiki />[...]]outside</code> a wikilink, which would otherwise adhere to the wikilink font. They can also add line-spacing in the wikitext. Template editors: tag {{tag|nowiki|o}} works only on its source page, not the target; also <code>{{#tag<nowiki />:nowiki | ''content''}}</code>, although it wraps that content in nowiki tags, it also does a [[mw:Manual:Tag extensions#How do I render wikitext in my extension?|pre-save transform]] on that content, which is entirely at odds with the intended purpose of nowiki for templates, subst, signatures, and the pipe-trick. The two kinds of nowiki operate in different ways to target content, but they both remove meaning (subtract rendering) of wiki markup, then disappear into the background font. Nowiki does nothing toward rendering, but it can add newlines to wikitext (for readability), just like the HTML comment (the preferred method) can. Unlike it does for wiki markup, nowiki does not remove the meaning of ''character entities'', either [[HTML character entities|HTML]] or MediaWiki [[#特殊字元|special ''characters'']]. There is only one meaning for what {{tag|nowiki}} contains, so it needs few examples; but the singular {{tag|nowiki|s}} tag "contains" ''many'' linkage structures, where it is expected between bracketing-pair characters or in the keyword area. So this section has ''many'' examples and few mis-examples. For example, only at the beginning of a line (bol of wikitext, bol in a transclusion, or beginning of a table cell), do {{code|*}}, {{code|#}}, {{code|;}} or {{code|:}} mean something. {{markup |<nowiki># Ordered list</nowiki> |{{crlf2}} # Ordered list |<nowiki><nowiki /># Ordered list</nowiki> |{{crlf2}} <nowiki /># Ordered list |<nowiki>A [[micro-]]second.</nowiki> |A [[micro-]]second. |<nowiki>A [[micro-]]<nowiki />second.</nowiki> |A [[micro-]]<nowiki />second. |<nowiki>a<nowiki> </nowiki>b</nowiki> |a<nowiki> </nowiki>b |<nowiki>'<nowiki />'Italics' markup'<nowiki />'</nowiki> |'<nowiki />'Italics' markup'<nowiki />' |<nowiki><nowiki>[[Example]]</nowiki></nowiki> |<nowiki>[[Example]]</nowiki> |<nowiki><!-- revealed --></nowiki> | <nowiki> <!-- revealed --> </nowiki> }} The rest of the section consists of simple, live examples showing how a single nowiki tag escapes entire linkage structures, beyond [[ wikilink <nowiki />]] and {{ template <nowiki />}}: :[[ ''[[wp:fullpagename|fullpagename]]'' <nowiki />| ''label'' ]] :{{ ''pagename'' <nowiki />| ''parameter'' }} :[[ ''fullpagename'' | {{ ''pagename'' }<nowiki />} ]<nowiki />] :{{ ''pagename'' | [[ ''fullpagename'' ]<nowiki />] }} :{{ ''pagename'' <nowiki />| {{ ''pagename'' }<nowiki />} }} Unless you use the two "balanced" nowiki tags, troubleshooting [[help:strip markers|strip marker]] errors and template parameter-handling inconsistencies is a risk. Also, a rendering error may arise when two <kbd>[<nowiki />[...]]</kbd> square brackets are on the same line, or two <kbd>{<nowiki />{...}}</kbd> curly brackets are in the same section, but only when the two have the nowiki markup placed inconsistently. ====Displaying wikilinks==== (These are all live examples.) <pre> [[ wp:pagename | page name ]] [<nowiki />[ wp:pagename | page name ]] [[<nowiki /> wp:pagename | page name ]] [[ wp:pagename <nowiki />| page name ]] [[ wp:pagename | page name ]<nowiki />]</pre> <poem> :[[ wp:pagename | page name ]] :[<nowiki />[ wp:pagename | page name ]] :[[<nowiki /> wp:pagename | page name ]] :[[ wp:pagename <nowiki />| page name ]] :[[ wp:pagename | page name ]<nowiki />] </poem> For '''nested structures''', escaping an inner structure escapes its outer structure too. <pre> [[ wp: {{ 1x | pagename }} ]] [[ wp: {<nowiki />{ 1x | pagename }} ]] [[ wp: {{<nowiki /> 1x | pagename }} ]] [[ wp: {{ 1x <nowiki />| pagename }} ]]</pre> <poem> :[[ wp: {{ 1x | pagename }} ]] :[[ wp: {<nowiki />{ 1x | pagename }} ]] :[[ wp: {{<nowiki /> 1x | pagename }} ]] :[[ wp: {{ 1x <nowiki />| pagename }} ]] </poem> For '''two, first pipes''', two nowiki tags are required: <pre> [[ wp: pagename | {{ 1x | label }} ]] [[ wp: pagename <nowiki />| {{ 1x <nowiki />| label }} ]] <nowiki>[[ wp: pagename | {{ 1x | label }} ]] </nowiki></pre> <poem> :[[ wp: pagename | {{ 1x | label }} ]] :[[ wp: pagename <nowiki />| {{ 1x <nowiki />| label }} ]] :<nowiki>[[ wp: pagename | {{ 1x | label }} ]] </nowiki> </poem> ====Displaying template calls==== {{See also|Template:tl}} For templates, put nowiki before the first pipe. If a parameter has a wikilink, put it in that, an inmost position. <pre> {<nowiki />{ val | u=&gt; [[ms]] | 49082 }} {{<nowiki /> val | u=&gt; [[ms]] | 49082 }} {{ val <nowiki />| u=&gt; [[ms]] | 49082 }} {{ val | u= > [[ms]] | 49082 }<nowiki />} {{ val | u= > [[ ms ]<nowiki />] | 49082 }} </pre> <poem> :{<nowiki />{ val | u=> [[ms]] | 49082 }} :{{ val | u= > [[ms]] | 49082 }<nowiki />} :{{<nowiki /> val | u=> [[ms]] | 49082 }} :{{ val <nowiki />| u=> [[ms]] | 49082 }} :{{ val | u= > [[ ms ]<nowiki />] | 49082 }} {{OK}} </poem> ====顯示魔術字==== {{Further|Help:魔術字|Help:魔术字#解析器函数}} For input '''parameters''', {{{1}}}, {{{2}}}, just write them out, unless they have a default (which goes behind their pipe): {{<nowiki />{1|default}}} → {{<nowiki />{1|default}}} For a '''parser function''' nowiki goes between bracketing-pair characters, or anywhere before the : colon. <pre> {{ #ifeq: inYes | inYes | outYes | outNo }} {<nowiki />{ #ifeq: inYes | inYes | outYes | outNo }} {{<nowiki /> #ifeq: inYes | inYes | outYes | outNo }} {{ #ifeq<nowiki />: inYes | inYes | outYes | outNo }} {{ #ifeq: inYes | inYes | outYes | outNo }<nowiki />}</pre> <poem> :{{ #ifeq: inYes | inYes | outYes | outNo }} :{<nowiki />{ #ifeq: inYes | inYes | outYes | outNo }} :{{<nowiki /> #ifeq: inYes | inYes | outYes | outNo }} :{{ #ifeq<nowiki />: inYes | inYes | outYes | outNo }} :{{ #ifeq: inYes | inYes | outYes | outNo }<nowiki />} </poem> '''Behavioral switches''' expect the tag anywhere: <pre> 1. __HIDDENCAT__ 2. __HIDDENCAT<nowiki />__</pre> :1. __HIDDENCAT__{{break}} :2. __HIDDENCAT<nowiki />__ ====Displaying tags==== {{tag|tags|o}} do not display; they are just markup. If you want them to, insert {{tag|nowiki|s}} after an {{code|<}} opening angle bracket; it goes only in the very front. Opening tags and closing tags must be treated separately. <pre> <span style=color:blue> Blue </span> <<nowiki />span style=color:blue> Blue <<nowiki />/span> <section end=la<nowiki />bel /> </pre> <poem> :<span style=color:blue> Blue </span> :<<nowiki />span style=color:blue> Blue <<nowiki />/span> :<section end=la<nowiki />bel /> {{cross}} </poem> Use template {{tl|tag}} instead of nowiki tags to display parser tags: '''Character entities''', nowiki cannot escape. To escape HTML or special character entities, replace <code>&</code> with <code>&amp;</code>. For example, <code>&amp;lt;</code> → <code>&lt;</code> To '''display a nowiki tag''', you can (1) use {{tl|tag}}, (2) replace the < left angle bracket with its HTML character entity, or (3) nest nowiki tags in each other: <pre> {{ tag | nowiki }} <code>&lt; nowiki>...&lt;/ nowiki ></code> <code><<nowiki />nowiki>...<<nowiki />/ nowiki ></code></pre> <poem> :{{ tag | nowiki }} :<code>< nowiki>...</ nowiki ></code> :<code><<nowiki /> nowiki>...<<nowiki />/ nowiki ></code> </poem> <pre> {{ tag | nowiki | s }} <code>&lt; nowiki /></code> <code><<nowiki /> nowiki /></code> <code><nowiki>< nowiki /></nowiki></code></pre> <poem> :{{ tag | nowiki | s }} :<code>< nowiki /></code> :<code><<nowiki /> nowiki /></code> :<code><nowiki>< nowiki /></nowiki></code> </poem> Nowiki tags do not otherwise nest, so it is the second and fourth that displays: <pre> 1<nowiki>2<nowiki>3</nowiki>4</nowiki> <nowiki>{{!}}<nowiki></nowiki>{{!}}</nowiki> </pre> <poem> :1<nowiki>2<nowiki>3</nowiki>4</nowiki> {{spaces|5}} ''{{small|second and fourth}}'' :<nowiki>{{!}}<nowiki></nowiki>{{!}}</nowiki> </poem> These simply scan from left to right. The paired tags cannot overlap, because the very first pair-match nullifies any intervening tags inside. Unbalanced tags always display. Nowiki tags do not display table markup, use {{tag|pre}}. ===Pre=== {{shortcut|WP:PRE}} {{tag|pre|o}} is a parser tag that emulates the HTML {{tag|pre|o}} tag. It defines preformatted text that is displayed in a fixed-width font and is enclosed in a dashed box. HTML and wiki markups are escaped and spaces and line breaks are preserved, but HTML entities are parsed. {{markup|title={{tag|pre|o}} examples |<nowiki><pre><!--Comment--> [[wiki]] markup &amp;</pre></nowiki> |<pre><!--Comment--> [[wiki]] markup &</pre> }} {{tag|pre|o}} formatted text does not wrap, thus text may extend past the browser window: <pre>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</pre> To resolve this, {{tag|pre|o}} may use CSS styling to add wrapping or a horizontal scrollbar: * Wrapping: {{tag|pre|o|params=style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;"}} * Scroll bar: {{tag|pre|o|params=style="overflow:auto; width:auto;"}} Alternatively, consider using {{tl|pre2}} template or {{xtag|syntaxhighlight|p|params=lang="text"}}.
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
帮助
讨论
大陆简体
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息