format

formatMicronode

Writes a number with separators — !format:comma{1234567} gives 1,234,567. Separators only, never a currency symbol: the symbol belongs to the sentence, not the number, so the author writes $!format:comma{}.

Explained in:Functions

#Attributes

asRequiredImplicit
commapercentscientificfixed
Which form to write: comma groups the integer part in threes, percent scales by 100 and appends %, fixed uses places with no grouping, and scientific writes mantissa and exponent.Can be written as shorthand: format:value
places
Decimal places. Omitted, comma and percent keep the value's own decimals, fixed uses two, and scientific writes five mantissa decimals.

#Allowed content

Body { }Inline Chalk content, read as a number

#Examples

The survey counted !format:comma{1234567} plants.
It covers !format:percent{0.4567}(places: 1) of the island.

#Notes

  • !format:comma{1234567} gives 1,234,567; !format:percent{0.4567}(places: 1), 45.7%; !format:fixed{3.1}, 3.10; !format:scientific{1234.5}, 1.23450e3.
  • There is no locale table behind this: the grouping is the document's, so the same page reads the same way everywhere.
  • A body that is not a number is left as it stands. The compiler used to refuse one; it no longer sees this at all, so the honest render is the author's own characters rather than NaN.