How does the current remains constant in an ideal capacitor?
Because we are using a linear voltage sweep, the current through the capacitor is constant when the voltage is increasing or decreasing.




In the article they are applying a linearly increasing voltage to the capacitor so the current will be constant as in the equation \$ I = C \frac{dV}{dt} \$.

You may be confusing it with the standard RC charge / discharge curves which give an exponential curve due to the decreasing current as the potential difference across the resistor decreases.