Docly Developers
Function Updated 17 Oct 2026

Chinit(name)

Creates a chapter counter with the specified name and sets it to "0". An existing variable with this name is overwritten.

The counter is a text value of numbers separated by dots, such as "2.1", and is written out with #name#. The function itself returns an empty string, so #chstep("c")# writes nothing. The function names are lower case: chinit, chstep, chdestep, chpush, chpop.

Parameters

namestringrequired

Name of variable to store chapter counter in.

Returns

Nothing, just initializes the variable.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#chinit("counter1")#

Counter 1 value is: #counter1#