Beispiel #1
0
        private void ValidateHref(TocItemViewModel item)
        {
            if (item.Href == null)
            {
                return;
            }
            var hrefType = Utility.GetHrefType(item.Href);

            if ((hrefType == HrefType.MarkdownTocFile || hrefType == HrefType.YamlTocFile || hrefType == HrefType.RelativeFolder) &&
                (UriUtility.HasFragment(item.Href) || UriUtility.HasQueryString(item.Href)))
            {
                Logger.LogWarning($"Illegal href: {item.Href}.`#` or `?` aren't allowed when referencing toc file.");
                item.Href = UriUtility.GetPath(item.Href);
            }
        }