Skip to content

Comment rewrap specification

Steven Nguyen edited this page Jul 5, 2025 · 2 revisions

Comment rewrap specification

This documents how metamath.exe rewraps comments (different from documenting how to rewrap).

It's a little bit faster to not have to rewrap, which requires knowledge of how formatting works:

Only comments before $a and $p statements get rewrapped

Comments with raw HTML do not get rewrapped

No trailing whitespace

Single newline --> space, Double newline stays

Single tildes (i.e. ~ but not e.g. ~~) must be surrounded with whitespace

Block tokens

The following cannot be broken up for rewrapping:

  • Math markup ` 1 + 1 = 2 `
  • Links ~ ax-1 , ~ https://example.com
  • Discouraged tags (Proof modification is discouraged.) and (New usage is discouraged.)

Note: This is true for links not because it was coded,
but because of the single tilde rule, no trailing whitespace rule, and that the URLs do not have spaces

Two spaces after .?!:

metamath.exe will change one space to two spaces after .?!: when a capital letter or opening punctuation (['" follows the space.

  • This means ~ (links), ` (math markup), _ (italics), 123 (numbers), abc (lowercase letters), etc. are exceptions:
    if the next sentence starts with these, only one space separates it from the previous sentence.

Exception: if the character before a . is a capital letter, the code assumes it's someone's initials and it's ignored.

Excpetion: p. (note the space before p) to keep spacing akin to "page 5".

A period . is added if the comment ends in a lowercase letter.

Clone this wiki locally