We can assume, without loss of generality, that $f$ is strictly increasing in $(a, b)$ as the proof for $f$ being strictly decreasing can be considered by taking $g = -f$. We will show that $f$ is strictly increasing in $[a, b]$ by contradiction. We can also assume that $f$ violates the monotony in the point $a$.
Let us assume that $f(a) = f(z)$ for some $z \in (a, b)$. The case $f(a) < f((a, b])$ doesn't violate the monotony and for the case $f(a) > f((a, b])$ it is easy to show that $f$ is not continuous.
Because $f$ is strictly increasing, we have that $f(\frac{a+z}{2}) < f(z)$. Let us write $f(\frac{a+z}{2}) = f(z) - 2k \iff f(\frac{a+z}{2}) + 2k = f(z)$ for some $k > 0$.
Because $f$ is continuous at $a$, we have:
$$\forall_{\epsilon > 0} \exists{\delta > 0}: |x-a| < \delta \implies |f(x) - f(a)| < \epsilon$$
Let us take $\epsilon = k$ and substitute $f(a)$ for $f(z)$ in that expression:
$$\exists{\delta > 0}: |x-a| < \delta \implies |f(x) - f(z)| < k$$
But because $f$ is strictly increasing in $(a, b)$, for every $\delta$ we pick, there is going to be some $x_0$ to the left of $\frac{a+z}{2}$ with $x - a < \delta$ and with $f(x_0) + c = f(\frac{a+z}{2}), c > 0$. Because $f(x_0) < f(\frac{a+z}{2})$, we have
$$|f(x_0) - f(z)| = |f\left(\frac{a+z}{2}\right) - c - f(z)| = f(z) - f\left(\frac{a+z}{2}\right) + c = 2k + c$$
Which is bigger than $\epsilon = k$.