Sokhotski–Plemelj theorem for the real line
Solution 1:
The first version also holds for $a,b\in\overline{\mathbb{R}}=\mathbb R\cup\{+\infty\}\cup\{-\infty\}$. The important part of the Sokhotski–Plemelj theorem is integrating around $x_0$ and not about the limits of the integral. It is not enough to say that $f$ must be continuous. The function also cannot have singularities neighborhood around $[a,b]$. Keep this in mind at the end result.
Proof: Define the contour $C=[a,x_0-\delta]\cup C_{x_0,\delta}\cup [x_0+\delta,b]$, where $C_{x_0,\delta}$ is a semicircular path of radius $\delta$ centered at $x_0$ with $\delta>0$. Then for $\delta\to0^+$
$$\int_C\frac{f(x)}{x-x_0}\,\mathrm{d}x=\mathcal P\int_a^b \frac{f(x)}{x-x_0}\,\mathrm{d}x+\int_{C_{x_0,\delta}}\frac{f(x)}{x-x_0}\,\mathrm{d}x.$$
Note that the contour $C_{x_0,\delta}$ can be parameterized as $x=x_0+\delta e^{i\varphi}$ for $0\leqslant\varphi\leqslant\pi$ or $-\pi\leqslant\varphi\leqslant0$. Taking $\delta\to0^+$,
$$\lim_{\delta\to0^+}\int_{\pm\pi}^0\frac{f(x_0+\delta e^{i\varphi})}{\delta e^{i\varphi}}i\delta e^{i\varphi}\,\mathrm{d}\varphi=f(x_0)\lim_{\delta\to0^+}\int_{\pm\pi}^0\frac{i\delta e^{i\varphi}}{\delta e^{i\varphi}}\,\mathrm{d}\varphi=\mp i\pi f(x_0).$$
We were able to pull the limit inside $f$, since it is by definition continuous on the real line. Assuming that $f$ has no singularities neighborhood around the interval $[a,b]$, we can deform the contour $C$ into a straight line, which runs from $a +i\varepsilon$ to $b+i\varepsilon$, so
$$\int_C\frac{f(x)}{x-x_0}\,\mathrm{d}x=\lim_{\varepsilon\to0^+}\int_{a\pm i\varepsilon}^{b\pm i\varepsilon}\frac{f(x)}{x-x_0}\,\mathrm{d}x=\lim_{\varepsilon\to0^+}\int_{a}^{b}\frac{f(x\pm i\varepsilon)}{x-x_0\pm i\varepsilon}\,\mathrm{d}x.$$
We may pull the limit inside $f$ again since the function is continuous on the real line. The end result is
$${\displaystyle \lim _{\varepsilon \to 0^{+}}\int _{a}^{b}{\frac {f(x)}{x-x_0\pm i\varepsilon }}\,\mathrm{d}x=\mp i\pi f(x_0)+{\mathcal {P}}\int _{a}^{b}{\frac {f(x)}{x-x_0}}\,\mathrm{d}x},$$
where $a<x_0<b$ and $a,b \in\overline{\mathbb{R}}$.