This is a variant of WimC’s idea that avoids continued fractions.
Let $K=\{0\}\cup\{2^{-n}:n\in\Bbb N\}$. Let $z$ be the infinite sequence of zeroes, and let
$$X=\left\{\langle x_k:k\in\Bbb N\rangle\in{}^{\Bbb N}K:\exists m\in\Bbb N\,\forall k\ge m(x_k=0)\right\}\setminus\{z\}\;.$$
Let $\preceq$ be the lexicographic order on $X$, and endow $X$ with the corresponding order topology. For $x=\langle x_k:k\in\Bbb N\rangle\in X$ let
$$\ell(x)=\min\{m\in\Bbb N:\forall k>m(x_k=0)\}\;.$$
For $n\in\Bbb N$ let $L_n=\{x\in X:\ell(x)=n\}$, and let $F_n=\bigcup_{k\le n}L_k$; $F_n$ is closed in $X$.
It’s not hard to show that $X$ embeds order-isomorphically and homeomorphically in $\Bbb Q$: start by sending $L_0$ to $K\setminus\{0\}$ in the obvious way, and recursively extend the embedding from $F_n$ to $F_{n+1}$ for $n\in\Bbb N$. Let $h$ be the resulting embedding, let $Y=h[X]$, and let $g=h^{-1}$.
Suppose that $x=\langle x_k:k\in\Bbb N\rangle\in L_n$; then $x_n\ne 0$, but $x_k=0$ for all $k>n$. For $k,m\in\Bbb N$ let
$$y_k^{(m)}=\begin{cases}
x_k,&\text{if }k\le n\\
2^{-m},&\text{if }k=n+1\\
0,&\text{if }k>n+1\;.
\end{cases}$$
For $m\in\Bbb N$ let $y^{(m)}=\left\langle y_k^{(m)}:k\in\Bbb N\right\rangle\in L_{n+1}$; then the sequence $\left\langle y^{(m)}:m\in\Bbb N\right\rangle$ converges (monotonically downward) to $x$ in $X$.
Now define
$$f:\Bbb R\to\Bbb R:x\mapsto\begin{cases}
2^{-\ell(g(x))},&\text{if }x\in Y\\
0,&\text{otherwise}\;.
\end{cases}$$
Fix $y\in Y$. Then $g(y)\in L_n$ for some $n\in\Bbb N$, and we just saw that there is a sequence $\langle z_m:m\in\Bbb N\rangle$ in $L_{n+1}$ that converges to $g(y)$. Thus, $\langle h(z_m):m\in\Bbb N\rangle$ converges to $x$ in $\Bbb R$, and $f(z_m)=2^{-(n+1)}$ for each $m\in\Bbb N$. On the other hand, $y$ is a limit of irrationals, and $f$ is zero on the irrationals, so $f$ has an essential discontinuity at $y$.
Finally, $f$ is continuous at each point of $\Bbb R\setminus Y$. To see this, let $y\in\Bbb R\setminus Y$. Let $\epsilon>0$ be arbitrary, and choose $n\in\Bbb N$ large enough so that $2^{-n}\le\epsilon$. Let $U=\Bbb R\setminus h[F_n]$; $U$ is an open nbhd of $y$, and $f(z)<2^{-n}\le\epsilon$ for each $z\in U$.
To make this discontinuous at all rationals, modify the definition of $f$ at points of $\Bbb Q\setminus Y$ to agree with the Riemann function as given in the question. Alternatively, modify the construction of $X$ by replacing $K$ by $K\cup\{-2^{-n}:n\in\Bbb N\}$, in which case $\langle X,\preceq\rangle$ can be mapped order-isomorphically and homeomorphically onto $\Bbb Q$.