About Mahony filter for euler angles estimation
Imagine a reference frame (inertial frame, spatial frame etc.). The orientation of the IMU is specified with respect to this reference frame. Let's explain part of the the algorithm with an example.
Let the reference frame be define so. Z axis points towards centre of earth; i.e. in the direction of gravitational force. Let the X axis point towards north. Y axis be defined in such a way as to get a right handed reference frame.
So the (normalised) gravity vector in the above reference frame is clearly1
$$\begin{bmatrix}
0\\
0\\
1
\end{bmatrix}$$
IMU however measures the acceleration (due to gravity if it is kept stationary) in it's own frame; usually called the body frame. In that frame, the (normalised) gravity vector coming from the accelerometer (as measured by the sensors rigidly fixed on the IMU) is
$$
\begin{bmatrix}
{}^s a_x\\
{}^s a_y\\
{}^s a_z
\end{bmatrix}
$$
Both the above vectors represent the same physical quantity; the gravitational force vector. However, we cannot compare them directly since both vectors have been resolved in different frames.
Let \$R_{true}\$ be the rotation matrix4 that allows you to convert a vector in the inertial reference frame to the IMU body frame. Then2,3
$$
\begin{bmatrix}
{}^s a_x\\
{}^s a_y\\
{}^s a_z
\end{bmatrix}
=
R_{true}
\begin{bmatrix}
0\\
0\\
1
\end{bmatrix}
$$
\$R_{true}\$ is unknown to us. What we have is only an estimate of \$R_{true}\$; Let's call it \$R_{est}\$. We want to bring \$R_{est}\$ closer to \$R_{true}\$ with each successive measurement.
To bring \$R_{est}\$ towards \$R_{true}\$, the correction-rotation that needs to be applied to \$R_{est}\$ is about the axis
$$
\left(
R_{est}
\begin{bmatrix}
0\\
0\\
1
\end{bmatrix}
\right)
\times
\begin{bmatrix}
{}^s a_x\\
{}^s a_y\\
{}^s a_z
\end{bmatrix}
=
\hat{v}_t
\times
\begin{bmatrix}
{}^s a_x\\
{}^s a_y\\
{}^s a_z
\end{bmatrix}
$$
Note that, when \$R_{est}=R_{true}\$, the correction-rotation-axis will become zero. The above shows what the vector \$v_t\$ is.
Conclusion
In short, \$\hat{v}_t\$ is the acceleration vector transformed into the estimated IMU frame so that it can be compared with the measured acceleration vector which is in the IMU frame.
Notes
1 It could be [0;0;-1] also depending on whether we are talking about force, reaction force, acceleration, or sensed acceleration. Let's not worry about that for this answer.
2 \$v_a = R^T e_3\$ is the notation in the first link you commented.
3 ideal sensor, perfect knowledge etc. etc.
4 The explanation is in terms of rotation matrices for notational convinience, but it can be easily adapted to quaternions.
5 The acceleration vector turned out to be very easy to represent in the inertial reference frame since one of the axes of the inertial frame was chosen to point towards the centre of the earth. This is not the case for magnetic vector. The magnetic vector \$\hat{w}_t\$ in general will have all three components non-zero however you choose the reference frame. But no worry, the expression for magnetic model in inertial frames can be calculated (approximately) from IGRF or WMM or any other model. We can also skip these models if we are willing to measure the magnetic field of the area where the experiments is conducted before the experiments starts.
edit: In our example, we defined inertial frame X axis as pointing towards (geographic) north. So the magnetic field will take a simple form and can be found from declination and inclination information.
6 Be very careful when following multiple reference documents / papers / websites / codes. Here in this example, we converted the inertial vector to estimated IMU frame and compared with the measured data in the IMU frame. But some follow the opposite convention. They convert measured data to estimated inertial frame and compare to the value in the inertial frame. Stick to one document / code / website which is correct and easy to understand and follow that. Do not mix and match formulae from different sources without checking their conventions.