$\newcommand{\ket}[1]{|#1\rangle}$ $\newcommand{\bra}[1]{\langle#1}$
This is a question that has long confused me, what is the actual functional form of a ket vector, specifically in the position basis? I am guessing the answer is that the ket vector is too abstract to have a functional form except perhaps under specific circumstances, but let me try to explain my confusion. In Shankar section 1.10, he describes a function being expanded as a series of kets as such:
Let us denote by $f_n(x)$ the discrete approximation to $f(x)$ that concides with it at $n$ points and vanishes in between. Let us now interpret the order $n$-tuple {$f_n(x_1)$,$f_n(x_2)$,...,$f_n(x_n)$} as components of a ket $\ket{f_n}$ in a vector space $V^n(R)$: $$\ket{f_n}\leftrightarrow \begin{bmatrix} f_n(x_{1}) \\ f_n(x_{2}) \\ \vdots \\ f_n(x_{n}) \end{bmatrix}$$ The basis vectors in this space are: $$\ket{x_i}\leftrightarrow \begin{bmatrix} 0 \\ 0 \\ \vdots \\ 1 \\ 0 \\ \vdots \\ 0 \\ \end{bmatrix}$$ corresponding to the discrete function which is unity at $x=x_i$ and zero elsewhere. (...) Try to imagine a space containing $n$ mutually perpendicular axes, one for each point $x_i$. Along each axis is a unit vector $\ket{x_i}$. The function $f_n(x)$ is represented by a vector whose projection along the $I$th direction is $f_n(x_i)$: $$\ket{f_n}=\sum_{i=1}^n f_n(x_i)\ket{x_i}$$
This discussion seems to imply that a ket $\ket{x}$ is either a kronecker delta or more realistically $\ket{x}=\int dx^\prime\delta(x-x^\prime)|x'\rangle$. The reason I am skeptical of this is that this would require an uncountably infinite number of Dirac deltas to define the entirety of a physical position space, as Shankar clearly relates each point in space with a distinct ket.
I am also skeptical given that $\int dx^\prime\delta(x-x^\prime)$ is a functional and therefore should live in the dual space, which is the space of bras (although I do understand there is a one to one correspondence between the two, although I am not sure how to see it explicitly in this case). I know this discussion often includes the idea of a "Rigged Hilbert Space", such as here, however I do not fully follow the discussion being had. Is Shankar's discussion here purely superficial and not meant to represent the underlying mathematics?
To further my confusion, I can imagine a wavefunction defined on a finite interval. We can expand this function in terms of a power series of polynomials. In this case, we would almost certainly associate $\ket{x}$ with $\ket{x_n}=x^n$ as the function would be properly expanded as: $$f(x)=\sum_{n=0}^{\infty} a_n x^n=\sum \ket{x}\bra{x}\ket{f}$$ in which clearly $a_n=\bra{x}\ket{f}$ and therefore $\ket{x}=x^n$, as the polynomials now form the basis (or at least a linear combination of polynomials form basis states, i.e. Laguerre polynomials). This differs from the previous interpretation of kets as Dirac deltas.
Any discussion or resources you could point me to about this would be greatly appreciated!