Dirac Notation and Coordinate transformation of a function
Under a coordinate transformation $y=f(x)$, where $f:\mathbb{R}\to\mathbb{R}$ is a diffeomorphism, the position ket & bra transform as half-densities $$\begin{align}|f(x)\rangle~=~&|f^{\prime}(x)|^{-1/2}|x \rangle,\cr \langle f(x)|~=~&|f^{\prime}(x)|^{-1/2}\langle x|,\end{align}\tag{A}$$ so that the completeness & orthogonal relations (2) transform covariantly.
Phrased equivalently, the wavefunction $$ \psi(x)~\equiv~ \langle x|\psi \rangle \tag{B} $$ transforms as a half-density under coordinate transformations.
We can then construct a half-form object $$ \psi(x)\sqrt{\mathrm{d}x} \tag{C}$$ that is invariant under coordinate transformations. A similar construction is used in e.g. geometric quantization.