Print opaque expressions that contain links to model elements

I’m using Capella 5.2.0 with M2Doc 3.2.1 and I want to print state transition guards that contain links to other model elements. When i just print the bodies, I get a href=“…”. When I use e.g. fromHTMLString(), with or without replaceLink(blob), nothing is printed.
Is there a possiblity to resolve these links so the name of the referenced model element is printed?

Thanks and regards,

If your text is an HTML link

<a href="...">link text</a>

it should be inserted as a link in the resulting document by the service fromHTMLString() if the all HTML document is passed (aka with header and body tags). If you only have the body contents you can use fromHTMLBodyString(). The replaceLink() service is mainly here to show how you can remplace internal references to MS Word bookmarks, if you have the same way to compute your bookmark IDs you can keep this call.

Thanks for the quick response! I try to explain it more precisely:
I created a guard with Ctrl+Space to select a functional exchange. In Capella the name of the exchange is shown:
When I print the “bodies” of the guard with M2Doc I get a href with the ID of the model element I selected with Ctrl+Space: <a href="387ec04c-f9f9-476e-b19d-86e4738d0bb9"/> &gt; 0
When I use bodies.fromHTLMString() or bodies.fromHTMLBodyString() only the part after the href is printed:
> 0
Is there a way to resolve this kind of href to the name of the element it points to?

The link doesn’t show any text, it should be:

<a href="387ec04c-f9f9-476e-b19d-86e4738d0bb9">TheExchange</a>

You might be able to fix this by creating a Java service that add the name of the referenced element in the MLink. You can have a look a the replaceLink() service for more details.