There is an article by Hans Hagen that explains how it is possible to migrate inserts from inner lists.
The code presented there can be easily adapted to work with OpTeX, and with marks as well (didn't test this thoroughly).
\newattribute\insattr
\directlua{
local hlist = node.id('hlist')
local vlist = node.id('vlist')
local ins = node.id('ins')
local mark = node.id('mark')
local has_attribute = node.has_attribute
local set_attribute = node.set_attribute
local ins_attribute = registernumber('insattr')
local function locate(head,first,last)
local current = head
while current do
local id = current.id
if id == vlist or id == hlist then
current.list, first, last = locate(current.list,first,last)
current = current.next
elseif id == ins or id == mark then
local insert = current
head, current = node.remove(head,current)
insert.next = nil
if first then
insert.prev, last.next = last, insert
else
insert.prev, first = nil, insert
end
last = insert
else
current = current.next
end
end
return head, first, last
end
local function migrate_inserts(where)
local current = tex.lists.contrib_head
while current do
local id = current.id
if id == vlist or id == hlist and not has_attribute(current,ins_attribute) then
set_attribute(current,ins_attribute,1)
local h, first, last = current.list, nil, nil
while h do
local id = h.id
if id == vlist or id == hlist then
h, first, last = locate(h,first,last)
end
h = h.next
end
if first then
local n = current.next
if n then
last.next, n.prev = n, last
end
current.next, first.prev = first, current
current = last
end
end
current = current.next
end
end
callback.add_to_callback('buildpage_filter',migrate_inserts,'migrate_inserts')
}
\headline={\botmark\hfil}
\begmulti 2
hello\mark{lorem ipsum}\fnote{Test} \lipsum[1-8]
\endmulti
\bye
Top of the page

Bottom of the page
