I think it's this:
%{
options.explanation = false; //This removes the generated toplevel <div>-tag from the result
const items = ...; //fetch and filter items from the Actor.items-collection
const itemList = $('<ul></ul>');
items.forEach(item => itemList.append(generateItemLink(item)));
return itemList.prop('outerHTML');
function generateItemLink(item) {
const itemBox = $('<li></li>');
const itemLink = $('<a></a>');
itemLink.addClass('content-link');
itemLink.attr({
'data-type': 'Item',
'data-entity': 'Item',
'data-id': item.id,
'data-uuid': item.uuid,
'data-tooltip': item.name ?? 'Item',
draggable: 'true'
});
const itemImg = $('<img></img>');
itemImg.attr({
src: item.img,
alt: `${item.name ?? 'Item'} image`,
draggable: 'false'
});
itemImg.addClass('custom-system-item-container-image');
itemLink.append(itemImg);
itemLink.append(item.name ?? '');
itemLink.on('click', () => {
item.sheet?.render(true);
});
itemBox.append(itemLink);
return itemBox;
}
}%
(or you use the @UUID-thing from Foundry, which converts such expressions to links. You can drag an Item to a Rich Text Editor to check the structure of that)

