Ejemplo n.º 1
0
        public override string ToString()
        {
            if (List == null || !List.Any() && Markdown != null)
            {
                return(Markdown.ToString());
            }

            var itemNo = 1;
            var text   = List.Aggregate("", (current, li) => current + string.Concat(itemNo++, ". ", li, "\n"));

            return(Markdown == null ? text : string.Concat(text, Markdown.ToString(), "\n"));
        }
Ejemplo n.º 2
0
        public override string ToString()
        {
            string text;

            if (!string.IsNullOrEmpty(Content))
            {
                text = string.Concat("**", Content, "**");
            }
            else
            {
                if (Markdown == null)
                {
                    throw new ArgumentNullException(nameof(Content) + " and " + nameof(Markdown) +
                                                    " cannot be null same time");
                }

                return(string.Concat("**", Markdown.ToString(), "**"));
            }

            return(Markdown == null ? text : string.Concat(text, Markdown.ToString()));
        }
Ejemplo n.º 3
0
        public override string ToString()
        {
            if (Items == null || !Items.Any())
            {
                return(Markdown.ToString());
            }

            var text = "";

            foreach (var item in Items)
            {
                text += string.Concat("* ", item.Parent, "\n");

                if (item.Childs == null || !item.Childs.Any())
                {
                    continue;
                }

                text = item.Childs.Aggregate(text, (current, child) => string.Concat(current, "    * ", child, "\n"));
            }

            return(Markdown == null ? text : string.Concat(text, "\n", Markdown.ToString()));
        }
Ejemplo n.º 4
0
        public override string ToString()
        {
            var text = string.Concat(string.Join("", Enumerable.Repeat("#", (int)HeadingLevel)), " ", Content);

            return(Markdown == null ? text : string.Concat(text, Markdown.ToString()));
        }
Ejemplo n.º 5
0
        public override string ToString()
        {
            var text = Elements.Aggregate("", (current, element) => current + string.Concat("- ", element, "\n"));

            return(Markdown == null ? text : string.Concat(text, Markdown.ToString(), "\n"));
        }