I read in a textbook, which had seemed to have other dubious errors, that one may construct a monotone function with discontinuities at every point in a countable set $C \subset [a,b]$ by enumerating the points as $c_1, c_2, \dots$ and defining $f(x) = \sum_{c_n < x}2^{-n}$. However, if seems that if we let $[a,b] = [0,1], C = \mathbb{Q} \cap [0,1]$, then $f(x)$ is constant $1$ everywhere except 0, an apparent counterexample.
So my question is: how does one construct a monotonic function which has discontinuities precisely on a countable set $C$? Further, are there any relatively easy-to-visualize constructions?