public static LinkReferenceDefinitionGroup GetLinkReferenceDefinitions(this MarkdownDocument document)
        {
            var references = document.GetData(DocumentKey) as LinkReferenceDefinitionGroup;

            if (references == null)
            {
                references = new LinkReferenceDefinitionGroup();
                document.SetData(DocumentKey, references);
                document.Add(references);
            }
            return(references);
        }
        public static LinkReferenceDefinitionGroup GetLinkReferenceDefinitions(this MarkdownDocument document, bool addGroup)
        {
            var references = document.GetData(DocumentKey) as LinkReferenceDefinitionGroup;

            if (references is null)
            {
                references = new LinkReferenceDefinitionGroup();
                document.SetData(DocumentKey, references);
                // don't add the LinkReferenceDefinitionGroup when tracking trivia
                if (addGroup)
                {
                    document.Add(references);
                }
            }
            return(references);
        }