Help:Section/ja
![]() |
注意: このページを編集すると、編集内容が CC0 のもとで公開されることに同意したと見なされます。詳細はパブリック・ドメインのヘルプ ページを参照してください。 | ![]() |
見出しの構文を使うことで、ページを節に分けることができます。
節の作成とナンバリング
節を作成するには、以下のように見出しを作ります。
==節== ===下位の節=== ====下位の下位の節===
節見出しの使用ガイドライン
- 一つのイコールで囲まれた
=このようなテキスト=
はページ名と同じ大きさになります。 - 節の見出しは、同じ行にある他のコンテンツと組み合わせることはできません。例えば、
==節見出し==<br>
は見出しとしてではなく、段落としてレンダリングされます。 - 節の名前は、下位の節の名前を含めて、ページ内で一意でなければなりません。 節の名前の重複によるデメリットには以下のようなものがあります。
- 編集の混乱 - 同じ名前の節が複数あると、編集時に混乱を招き、編集者がコンテンツを正確に編集するのが難しくなります。
- 曖昧な編集要約 - MediaWiki ではページの編集に対して編集の要約が生成されますが、複数の節が同じ名前を持っていると、それが曖昧になることがあります。 例えば、「ダイエット」という節が二つあると、編集要約に「私は『ダイエット』節を編集しました」と記載され、編集者が混乱し、最近の変更を効率よく確認できなくなります。
- テンプレートまたはページを使用することで、それぞれ独自の編集履歴を持つ別々の節を異なるページに作成できます。 各テンプレートやページはメインページに挿入でき、全体的な外観を変えずにコンテンツを追加できます。 こうすることで変更の追跡や、ページの特定の部分の管理が容易になります。 (Help:テンプレート#テンプレートの使用例を参照してください。)
- 新しいページ内に節を含むテンプレートを配置すると、そのテンプレートは元の順序を保持し、テンプレートの前後のコンテンツと結合されます。 これにより、テンプレート内の節の番号付けが正しく行われ、メインページの節の番号付けには影響を与えません。 この機能は、記事の内容外に目次を表示する外装 (例えば、Vector 2022 外装) ではサポートされていません。
- A section header in wikitext on MediaWiki is specified by the regular expression,
/(^={1,6}.*?={1,6}\s*?$)/m
(m
refers to a multi-line mode).
目次 (TOC)
目次(TOC)は4つ以上の見出しのあるページには自動的に生成されます。
編集画面でマジックワード__NOTOC__
(二つのアンダーラインで囲む)を入力することで目次を削除できます。
目次のガイドライン
- 見出しが4つ未満でも__FORCETOC__もしくは__TOC__を追加することで目次が追加され、__NOTOC__も上書きします。
- __FORCETOC__を使用すると、目次 (TOC) が最初の見出しの前に表示されるようになります。一方、__TOC__を使用すると、置かれた位置に目次が表示されるため、右側や表のセル内などの柔軟な配置が可能になります。
- __TOC__は記事の目次の場所を調節できます。 目次を表示したい位置に__TOC__を使うと、例えば記事の冒頭の紹介の後や、ページの最後に目次を設置できます。 これにより追加の見出し無しで、目次を適切な位置に配置できます。
- __NOTOC__を使うと自動で作られる目次が表示されなくなります。 自動生成される目次ではなく、シンプルな目次を作成したい場合は、== A == のような見出しを使って手動でリンクを作成し、[[#A|A]]" のような節のリンクを使用してそれらの節にリンクさせられます。
概要
マジックワード | 説明 |
---|---|
__NOTOC__ | 現在のページの目次を非表示にします。 |
__FORCETOC__ | 目次を表示します。 |
__TOC__ | 目次をページの指定位置に追加します。そのため__NOTOC__は上書きされます。 __TOC__が複数ある場合、最初のもののみ有効です。 |
目次の移動
下のコードは目次を画面右側にフローティング表示で表示できます。
{| align="right"
| __TOC__
|}
目次の深さの制限
LocalSettings.php
ファイル内の$wgMaxTocLevel の設定を調整することで、目次の深さ(細かさ)を変更できます。
例えば設定を3にすると、目次はレベル3(イコール3つ)までしか表示されません。
節へのリンク
見出しは自動的にid
属性を持つHTMLを生成します。これを用いることで、同じページ内または他のページから直接リンクで繋げられます。
例えば、この節の冒頭で作成された HTML コードは、このページの英語版では以下のようになります。
<h2><span class="mw-headline" id="Linking_to_a_section">Linking to a section</span></h2>
この節へのリンクは、以下のように表示されます。
[[Help:Section/ja#Linking to a section|Section linking]]
同じページ内の節へは [[#section link|表示されるテキスト]]
を使用してリンクを作成でき、別のページの節へは [[ページ名#節の名前|表示されるテキスト]]
を使用してリンクを作成できます。
アンカーは節の階層を考慮しないため、下位の節や下位の下位の節などへのリンクも、[[#下位の節の名前]]
や [[#下位の下位の節の名前]]
のようになります。
Duplicate section names are denoted by appending an underscore and a number. For instance, if there are three sections named "Example", they will be labeled "Example", "Example_2", and "Example_3". However, when editing sections "Example_2" or "Example_3", the edit summary confusingly directs to "Example". A blank heading in a section distorts the Table of Contents (TOC).
任意のIDでの節へのリンク
節へのリンクアンカーは予告なく変更されることがあります。特に、記事内に同名の節が複数ある場合にその傾向が顕著です。
" 2" や " 3" のよう識別子が、これらの節を区別するために追加されることがあります。
節が追加、削除、名称変更されると、リンク先が変更される可能性があり、誤った節や存在しない節に繋がることがあります。
これはHTMLの<span>
タグとid
属性を使用することで避けることができます。
<span id="アンカー名"></span>
Please ensure that the chosen name is unique by incorporating abbreviated titles from higher-level sections, such as Ontario-Natural_features
for the "Natural Features" subsection within the "Ontario" section of a Canadian provinces article.
This method may not function on older browsers, particularly those before MediaWiki 1.4.10, and it might not work even with modern browsers if the id
contains spaces.
例:
<span id="オンタリオの自然の特徴">(オプションテキスト)</span> [動作しない] <span id="ニューファンドランドの自然の特徴">(オプションテキスト)</span> [動作する] ... [[#オンタリオの自然の特徴|natural features of Ontario]]と[[#ニューファンドランドの自然の特徴|natural features of Newfoundland]]を参照してください
Replace spaces in the id with underscores to ensure links work seamlessly with both underscores and spaces.
- Internal links in section headings do not complicate section linking:
- 節へのリンクはパイプ トリックとの互換性はありません。
[[#section|]]
-> [[#section|]][[page#section|]]
-> [[page#section|]][[namespace:page#section|]]
-> [[namespace:page#section|]]
See manual anchors for linking to any section on a page.
節へのリンクとリダイレクト
Linking to a specific section of a page through a Help:redirect usually functions similarly to linking directly to that section.
Renaming a page generates a redirect, but renaming a section does not. Additionally, there is no distinct backlink feature for sections ; pages linking to a section are listed among pages linking to the entire page. To address these issues:
- Instead of directly linking to a section, use a page that redirects to the section. This approach facilitates tracking changes to section names and provides a "what links here" functionality for sections. To identify links to the section, check for redirects linking to the page and select the relevant one.
- Insert an anchor within the section and link to it accordingly.
- Add a comment at the beginning of a section in the wikitext, listing pages that link to that section.
- Create a separate page or template for the section and either transclude it into the parent page or link to it. Then, instead of linking directly to the section, link to the separate page or template.
Redirect pages can be put into categories by adding a category tag after the redirect command. If the redirect leads to a section, it somewhat categorizes that section too. However, the section will not link back to the category unless specifically done. On category pages, redirects are shown in italics. For more details, check out w:Wikipedia:Categorizing redirects.
節の編集
ページの特定の節のみを編集するには、節見出しの横にある [編集]
リンクをクリックします。
これをクリックすると、以下のようなURLの編集ページに飛ばされます。
https://www.mediawiki.org/w/index.php?title=Help:Advanced_editing&action=edit§ion=9
節の編集では、節の名前ではなく番号が使用されます。
下位の節は 1 つの番号で表されます (例: 上記のリンクでは、目次の節 2 はリンク内では 9 番として番号付けされています)。
これにより、ページのテキスト全体を表示する必要がなく、集中して編集できるようになります。
編集の手順を簡略化し、乱雑さを軽減するため、特に大きなページで便利です。
Adding __NOEDITSECTION__
section editing via a URL you already have still works.
When inserting a section, edit the previous or following section, merge by deleting the heading if necessary, and adjust the edit summary accordingly.
Including a section at the end
To add a new section at the end of a page, you can use a URL like the following:
https://www.mediawiki.org/w/index.php?title=Project:Sandbox&action=edit§ion=new
On talk pages and pages with wikitext, you can use the code __NEWSECTIONLINK__
to generate a special link beside the edit tab titled "⧼skin-action-newsection⧽".
Clicking this link will open a text box where you can enter a headline for the new section.
The edit summary is automatically generated.
The edit summary produced will be /* Section Name */ /* Section Name */ 新しい節
, which is automatically rendered as a right arrow.
This leaves no option for providing a custom edit summary.
If the subject box is left blank, no empty == ==
delimiter is inserted, and the content is appended to the page's last section.
This approach does not support creating a new section without a title and does not allow for providing an edit summary.
The "Preloadtitle" parameter determines the first text displayed in the "Subject/headline" field:
https://www.mediawiki.org/w/index.php?title=Project:Sandbox&action=edit§ion=new&preloadtitle=pqr
The preload can be edited before it is saved.
Editing before a first section
Generally, there is no designated link for editing the introductory text before the first section heading (phab:T2156). However, you can apply the section editing feature to this part by using 0 as the section number in the link, like this:
https://www.mediawiki.org/w/index.php?title=Help:Advanced_editing&action=edit§ion=0
Alternatively, you can modify any section edit link on the page by changing the section number.
To generate the same URL using JavaScript, see w:Wikipedia:WikiProject User scripts/Scripts/Edit Top.
Help:Section editing demo を参照してください
プレビュー
前の節の画像が現在の節と重なっている場合、節の編集のプレビューがページ全体と異なる場合があります。
The edit page displays all templates used on the entire page, including those from other sections.
Working with subsections
When editing a section, subsections are included and numbered relative to the edited part, starting at 1. Subsections are denoted with numbers like 1.1, 1.2, etc. The heading format follows the absolute level, with sub-subsections numbered accordingly. For example, a sub-subsection 3.2 would be numbered 3.2.1, 3.2.2
Editing a page with large sections
If a page has large sections or lacks division into sections, users can still modify the content by:
- Starting with a blank line before the new section heading, and adding a section with a specified large section number.
- Adding content to the last section without a heading, but unable to revert or edit the new text due to browser or connection limitations.
Editing sections of included templates
You can edit sections within included pages or templates.
Clicking the edit link for a section takes you to the edit page of the separate page.
This section (transcluded from Help:Section/Editing sections of included templates ) shows how it works.
The size of the section within the included page or template is determined by the headings in the main page where it is included. Also, texts before the first heading of the separate page is part of the section, but clicking its edit link won't show its text. Similarly, if there are texts after the template tag without a heading, you need to click the headings before the template to edit it. This section shows how it works. To ensure clarity and consistency in rendered parent pages, follow these guidelines:
- テンプレートの構造 - Avoid placing any text before the first heading within a template.
- 節の処理 - After using a template with sections, start a new section on the parent page. This prevents conflicts between template sections and parent page sections.
Additionally, consider the following practices for managing templates effectively:
- テンプレートの見出し - Sometimes it's helpful to start a template with a heading, even if it's just one section. これにより編集が簡単になります。
- Parameter use - When editing templates, remember parameters, such as
{{{1}}}
, are changed in the calling page, not directly in the template. Although this may not be immediately apparent in the rendered page, providing explanatory text or an additional edit link can enhance user understanding. - NOEDITSECTION タグ - The __NOEDITSECTION__ tag affects the template and any pages it's added to, along with other templates on the same page. Instead, consider replacing MediaWiki section header markup with HTML header markup within the template, causing the headers to remain visually consistent while avoiding recognition as editable sections. This approach eliminates the need for __NOEDITSECTION__ within the template.
For example, think of a template structured as follows:
==テンプレートの見出し1==
本文
===テンプレートの見出し2===
本文
To prevent "edit section" links from appearing when transcluding a template, add NOEDITSECTION within the template's code. However, this suppresses all "edit section" links on pages where the template is used.
Alternatively, structuring the template with HTML heading tags (<h2>
, <h3>
, etc.) achieves the same visual effect without affecting other sections' edit links on transcluding pages.
<h2>テンプレートの見出し1</h2>
本文
<h3>テンプレートの見出し2</h3>
本文
Sections within a parser function
When conditionally transcluding a template with sections using a parser function , the edit links for these sections may direct to the wrong section or show an error message claiming the section does not exist. This occurs because the content of conditionally included templates is considered part of the page itself, causing the sections to be counted after expansion.
As a result, the edit links for sections within the included template link to the page instead of the template, and the subsequent edit links refer to the correct page but with incorrect section numbers. This issue does not arise when transcluding a template with a conditional name, which offers additional advantages.
脚注の編集
To edit a footnote in a section using <references />
, find the section with the footnote mark and edit it.
Check Help:Footnotes for more help.
節単位の表示
節単位の編集機能を使用すると、ページ全体を読み込まずに特定の節を表示できます。
節、ページの分割、参照読み込みの使い分け
それぞれの利点は以下の通りです。
節で分けられた大きなページの利点
- 複数の小さなページにアクセスする場合と比べて、アクセスが高速になり、検索が簡単になります。
- 複雑なトピックでの概念的一貫性を維持できます。
ページを分割する利点
- リンク元 機能を使用して、リンクや履歴を個別に表示できます。、簡単にナビゲートや編集ができます。
- Faster loading times due to smaller page sizes.
- Automatic redirection upon renaming.
- Improved organization and data management through independent categorization and annotation.
- A few templates limit the apply per page.
Advantages of compound documents by 参照読み込み :
- 参照読み込み involves including the content of one page within another, often accomplished through templates.
- Users can navigate and search within the combined rendered page, which enhances usability.
Disadvantages:
- Users cannot search within the combined wikitext directly.
- Providing titles for each included page can be cumbersome.
- There is a limitation related to the size of post-expand includes, potentially causing technical issues, particularly with large or numerous included pages.
節と目次(ToC)
Adding Non-Section Text to TOC
You can mark text as a TOC entry by using <h4>...</h4>
header tags.
Customize formatting as usual inside these tags.
An Example usage (the second one is better formatted for clarity):
{| class="collapsible collapsed" style="text-align:left; border:0px; margin-top:0.2em" |- ! style="background-color:#f2dfce" | <h4>Stuff</h4> |- | Contents about stuff here |} {| class="collapsible collapsed" style="text-align:left; border:0px; margin-top:0.2em" |- ! style="background-color:#f2dfce; padding-top:0; padding-bottom:0" | <h4 style="margin:0; padding:0;font-size:95%">More stuff</h4> |- | Contents about more stuff here |}
To clarify, you want the collapse boxes headers treated as section titles, included in the table of contents (TOC), without necessitating formal "section titles" on the page itself.
Although not recommended, it is possible to create a TOC entry that is not in the text but acts as an anchor for linking to a section header with slightly different wording:
<h4 style="display:none">Your heading here</h4>
Sections for the above demo
Demo abc
This section is linked to from #Linking to a section.
関連項目