I want to produce margin notes like this
But they should behave like \marginnote command. The reason I want this is the flexibility of tikz package when I want to modify how the content should appear (e.g., boxes, backgrounds, alignment, transparency, anchors, etc)
MWE
\documentclass{book}
\usepackage[a4paper]{geometry}
% BEGIN_FOLD
\geometry{twoside=true, showframe=true}
\geometry{inner=5mm, outer=5mm, includemp=true, marginparsep=3.5mm, marginparwidth=61mm}
% END_FOLD
\usepackage{blindtext}
\usepackage{bigstrut}
\usepackage{tikz,tikzpagenodes}
\usepackage{marginnote}
\begin{document}
\noindent%
\begin{tikzpicture}[baseline, remember picture, overlay]
\node[text width=61mm, align=flush left, inner xsep=0pt, inner ysep=1pt, outer xsep=0pt, outer ysep=0pt, anchor=north east] at (current page marginpar area.north east) {\bigstrut \blindtext};
\end{tikzpicture}%
%
\smash{\rlap{\rule{\dimexpr \linewidth + \marginparsep + \marginparwidth \relax}{0.1pt}}}%
\blindtext
\newpage
\noindent%
\begin{tikzpicture}[baseline, remember picture, overlay]
\node[text width=61mm, align=flush left, inner xsep=0pt, inner ysep=1pt, outer xsep=0pt, outer ysep=0pt, anchor=north east] at (current page marginpar area.north east) {\bigstrut \blindtext};
\end{tikzpicture}%
%
\smash{\rlap{\hspace*{\dimexpr - \marginparsep - \marginparwidth \relax}\rule{\dimexpr \linewidth + \marginparsep + \marginparwidth \relax}{0.1pt}}}%
\blindtext
\newpage
\marginnote{\blindtext}%
\blindtext
\end{document}


todonotespackage? If I remember correctly, it is built upon tikz and it allows a lot of customization. – Jes Jun 27 '23 at 23:58