The following example produces a line break after the second text.
\define[2]\smallfigure{\placefigure[margin][#1]{#2}{!}}%
\starttext
text text\smallfigure{fig1}{A}text text
\stoptext
The ConTeXt FAQ addresses this explicitly. However, although the problem seems identical, changing the macro to
\define[2]\smallfigure{\dontleavehmode\placefigure[margin][#1]{#2}{!}}%
does not work as intended and avoiding the macro altogether
\starttext
text text\dontleavehmode\placefigure[margin][]{A}{!}text text
\stoptext
does not work either. Is there a way to avoid the line break?