/// <inheritdoc/> protected override void Write(MamlRenderer renderer, LinkInline link) { var url = link.GetDynamicUrl != null?link.GetDynamicUrl() ?? link.Url : link.Url; if (link.IsImage) { RenderImage(renderer, link, url); } else // link is not an image { if (Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute)) { renderer.Push(MamlElements.externalLink); renderer.Push(MamlElements.linkText); renderer.WriteChildren(link); renderer.PopTo(MamlElements.linkText); renderer.Push(MamlElements.linkUri); renderer.Write(url); renderer.PopTo(MamlElements.linkUri); renderer.PopTo(MamlElements.externalLink); } else // not a well formed Uri String - then it is probably a fragment reference { // the challenge here is to find out where (in which file) our target is. The file might even not be defined in the moment var(fileGuid, localUrl) = renderer.FindFragmentLink(url); string totalAddress = string.Empty; if (null != fileGuid && null != localUrl) { totalAddress = fileGuid + "#" + localUrl; } renderer.Push(MamlElements.link, new[] { new KeyValuePair <string, string>("xlink:href", totalAddress) }); renderer.WriteChildren(link); renderer.PopTo(MamlElements.link); } } }