API:Compare/th

ดูความแตกต่างระหว่างสองหน้า

Response


รหัสตัวอย่าง


ข้อบกพร่อง (error) ที่อาจเกิด


ประวัติพารามิเตอร์ (Parameter history)

 * v1.32: เปิดตัว,  ,  ,  ,  ,  ,  ,  ,  ,
 * v1.30: เปิดตัว,  ,  ,
 * v1.20: เปิดตัว ,



บันทึกเพิ่มเติม
หากต้องการทราบความแตกต่างระหว่างสองหน้า ต้องส่งหมายเลขการแก้ไข ชื่อหน้า หรือรหัสหน้าสำหรับทั้ง  และ

Relative comparison at first and last revision

 * You can ask for a relative comparison to prev at the first revision of a page, this will result in the full text of the first revision being returned as the diff. Note that this is not accurate, since in some cases there may be default content for the page before its first revision. The  property will be absent from the results.
 * Similarly, you can ask for the next relative comparison on the last revision of a page.
 * (Note: this is the last revision as of the writing of this topic. Because the page is protected, it probably should not change.) The result is an empty diff, and the  will be absent. Unlike most revision comparisons, these results will change if a new revision is created.

This behavior in the API is historical. It isn't consistent with the conceptual model of page history as a series of revisions. There is no  revision to compare against the first revision, nor is there a   revision to compare against the last. Because of this, future versions of MediaWiki may give different results for this API call.

Using the HTML output
The values  and  return HTML snippets. The HTML is a list of table rows ( elements) which should be embedded into a table with at least the following markup:

To display metadata as well, e. g. the user or comment, add extra rows and place the metadata inside a  element.

To make sure this diff displays correctly (e. g., that the diff marker and content columns aren’t the same width), you can add the  ResourceLoader module to your page:

If you want to display the, you will likewise want to add the  module, which includes some basic styles for comments and autocomments:

And if you want to display both the and the  HTML on the page, you can combine these two tags into one: