public static void SetLinkReferenceDefinition(this MarkdownDocument document, string label, LinkReferenceDefinition linkReferenceDefinition)
        {
            if (label == null)
            {
                ThrowHelper.ArgumentNullException_label();
            }
            var references = document.GetLinkReferenceDefinitions();

            references.Set(label, linkReferenceDefinition);
        }
        public static bool ContainsLinkReferenceDefinition(this MarkdownDocument document, string label)
        {
            if (label == null)
            {
                ThrowHelper.ArgumentNullException_label();
            }
            var references = document.GetData(DocumentKey) as LinkReferenceDefinitionGroup;

            if (references == null)
            {
                return(false);
            }
            return(references.Links.ContainsKey(label));
        }
        public static bool TryGetLinkReferenceDefinition(this MarkdownDocument document, string label, out LinkReferenceDefinition linkReferenceDefinition)
        {
            if (label == null)
            {
                ThrowHelper.ArgumentNullException_label();
            }
            linkReferenceDefinition = null;
            var references = document.GetData(DocumentKey) as LinkReferenceDefinitionGroup;

            if (references == null)
            {
                return(false);
            }
            return(references.TryGet(label, out linkReferenceDefinition));
        }
Exemple #4
0
        public static void AddAbbreviation(this MarkdownDocument document, string label, Abbreviation abbr)
        {
            if (document == null)
            {
                ThrowHelper.ArgumentNullException(nameof(document));
            }
            if (label == null)
            {
                ThrowHelper.ArgumentNullException_label();
            }
            if (abbr == null)
            {
                ThrowHelper.ArgumentNullException(nameof(abbr));
            }

            var map = document.GetAbbreviations();

            if (map == null)
            {
                map = new Dictionary <string, Abbreviation>();
                document.SetData(DocumentKey, map);
            }
            map[label] = abbr;
        }