Manual:Hooks/FormatAutocomments

Given a comment (e.g. edit summary) like, the parsed comment will be. Unhandled autocomments will be assumed to be section IDs and turned into links.

Details

 * &$comment: Reference to the accumulated comment. Initially null, when set the default code for formatting autocomments will be skipped.
 * $pre: True if the autocomment is the last part of the comment.
 * $auto: The extracted part of the comment before the call to the hook.
 * $post: True if the autocomment is the first part of the comment.
 * $title: An optional title object identifying the page the comment belongs to. Can be null.
 * $local: Boolean indicating whether the formatted comment will be displayed on the page it is about (e.g. in a diff view). When true, links to sections or other anchors should typically only contain the fragment, not the path or query part of the URL.
 * $wikiId: The wiki ID of the wiki the comment belongs to.

The hook was added in MW 1.20 but the signature was significantly changed in 1.25.

Note that  and   are the opposite of what one might expect. Before 1.25 these held the part of the comment before / after the autocomment; now they just say whether the part before / after the autocomment exists.