Manual:Live preview/ja

Live preview(ライブプレビュー)は残りのフォームのHTMLコードをリロードすることなく編集上の記事もしくはセクションのプレビューを表示することを可能にするMediaWikiの機能です.

Advantages

 * less incoming traffic: wikicode and all the menus are not received from the server again,
 * faster response time,
 * same cursor position in the editing window.

Disadvantage: only preview area is updated, which means:
 * interwiki, categories and used templates lists are not updated,
 * optional css files might be missing (e.g. if user adds &lt;source> tag),
 * scripts (such as sortable tables) are not executed.

Technical details
A live preview of an arbitrary MediaWiki markup string is returned if an appropriate flag is set when submitting a page via the "edit" action.

The following arguments to index.php should be passed via POST request:
 * 1) title=Page_Title
 * 2) wpPreview=true
 * 3) live=true
 * 4) wpTextbox1=String

結果は wpTextbox1 フィールドの値として渡された文字列のプレビューです. This is similar to the result of  index.php parameter when viewing a page.

The title argument is actually used only if the string contains magic words such as.

Implementation
This feature should be exploited by JavaScript code with a "Live preview" button on the edit form. This button should submit the text with  flag and show resulting preview.

Live preview is currently disabled on Wikimedia projects, probably due to potential incompatibilities with some older browsers.

However, several userscripts are available, like qPreview and Quick Preview.

Also a script using built-in preview.js is possible.

Other uses
Live preview can be potentially used in a way other than in the edit form. For example, the current timestamp on the English Wikipedia is the 14-digit number within the result of the executing the following command:

Alternatives
A similar preview functionality is now implemented in API, using the parse function. As an example, the current time stamp can be obtained by:

ライブプレビューを有効にする
ライブプレビューを on または off にするには LocalSettings.php の $wgLivePreview 変数で行います. 個人設定ページの「編集」タブで利用者ごとに有効にしなければなりません.