!format
Writes the number in its body with thousands separators, as a percentage, to fixed places or in scientific form.
!format#Attributes
asWhich form to write. comma groups the whole part in threes; percent multiplies by 100 and adds a per cent sign; fixed writes
places decimals with no grouping; scientific writes a mantissa and a power of ten, as in 1.23450e3.commapercentscientificfixedCan be written as shorthand:
!format:valueplacesDecimal places, a whole number. Omitted, comma and percent keep every digit the value has, fixed writes two and scientific five.
#Allowed content
Body { }Inline Chalk content, read as a number
#Examples
The survey counted !format:comma{1234567} plants.Imports rose !format:percent{0.0425}(places: 1) to \$!format:comma{2830000000}.#Notes
!format:comma{1234567}gives1,234,567;!format:percent{0.4567}(places: 1)gives45.7%;!format:fixed{3.1}gives3.10;!format:scientific{1234.5}gives1.23450e3.- Without
places, the digits comma and percent keep include those of floating-point arithmetic:!format:percent{0.07}gives7.000000000000001%. - The separators are a comma between thousands and a point before decimals, whatever the reader's locale.
- The body is trimmed and read as a number. A body that is not a number renders as written.
- A
{{…}}expression in the body is read at its current value, so!format:comma{ {{#total.value}} }follows a live number. - A currency symbol belongs to the sentence and is written before the micronode, escaped:
\$!format:comma{…}. An unescaped dollar sign pairs with the next one in the paragraph and opens maths.