I want to typeset the hyphens in the margin using plain TeX (I'm using the XeTeX engine, if that's important to you). For example:
Lorem ipsum dolor sit amet, consecte-
tuer adipiscing elit. Aenean commodo
ligula eget dolor. Aenean massa. Cum
sociis natoque penatibus et magnis
dis parturient montes, nascetur ridi-
culus mus. Donec quam felis, ultrici-
es nec, pellentesque eu, pretium
quis, sem. Nulla consequat massa
quis enim. Donec pede justo, fringil-
la vel, aliquet nec, vulputate eget,
arcu.
There is a similar question on this website Put hyphen on the margin, not in the text, but it only covers LaTeX and ConTeXt.
I think the way to go is to redefine \hypenchar
so that it produces \discretionary{\rlap-}{}{}
.