Exemplo n.º 1
0
 private static YamlLink CreateLink(MamlLink mamlLink)
 {
     return(new YamlLink
     {
         Href = mamlLink.LinkUri,
         Text = mamlLink.LinkName
     });
 }
Exemplo n.º 2
0
        private static XElement CreateLink(MamlLink link)
        {
            // PowerShell help engine is not happy, when LinkUri doesn't represent a valid URI
            // but it's often convinient to have it (i.e. relative links between markdown files on github).
            // so, we are ignoring non-uri links when rendering the final maml.
            // https://github.com/PowerShell/platyPS/issues/164
            if (link.IsSimplifiedTextLink)
            {
                return(null);
            }

            string uriValue = string.Empty;
            Uri    uri;

            if (Uri.TryCreate(link.LinkUri, UriKind.Absolute, out uri))
            {
                uriValue = link.LinkUri;
            }

            return(new XElement(mamlNS + "navigationLink",
                                new XElement(mamlNS + "linkText", link.LinkName),
                                new XElement(mamlNS + "uri", uriValue)));
        }