Example #1
0
        /// <summary>
        /// Initializes a new instance of <see cref="SetextHeading"/>
        /// with header level.
        /// </summary>
        /// <param name="elem">
        /// The <see cref="UnknownElement"/> object to create this object from.
        /// </param>
        /// <param name="level">The header level.</param>
        /// <param name="config">Configuration of the parser.</param>
        internal SetextHeading(UnknownElement elem, int level, ParserConfig config) : base(config)
        {
            if (level != 1 && level != 2)
            {
                throw new ArgumentException("level must be 1 or 2.", nameof(level));
            }

            HeaderLevel = level;
            content     = string.Join("\r\n", elem.content).TrimEnd(new[] { ' ', '\n', '\r', '\t' });
            warnings.AddRange(elem.Warnings);
        }
 /// <summary>
 /// Initializes a new instance of <see cref="LinkReferenceDefinition"/>
 /// with link label ,destination, title.
 /// </summary>
 /// <param name="label"></param>
 /// <param name="destination"></param>
 /// <param name="title"></param>
 /// <param name="elem"></param>
 /// <param name="config">Configuration of the parser.</param>
 internal LinkReferenceDefinition(string label, string destination, string title, UnknownElement elem,
                                  ParserConfig config) : base(config)
 {
     Label       = GetSimpleName(label?.Trim(whiteSpaceChars) ?? throw new ArgumentNullException(nameof(title)));
     Destination = InlineElementUtils.UrlEncode(InlineText.HandleEscapeAndHtmlEntity(
                                                    destination ?? throw new ArgumentNullException(nameof(destination))));
     Title = title == null ? null : InlineText.HandleEscapeAndHtmlEntity(title);
     warnings.AddRange(elem?.Warnings ?? new List <string>());
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of <see cref="Paragraph"/>.
 /// </summary>
 /// <param name="element">
 /// The <see cref="UnknownElement"/> object to create this object from.
 /// </param>
 /// <param name="config">Configuration of the parser.</param>
 internal Paragraph(UnknownElement element, ParserConfig config) : base(config)
 {
     contents = element.content;
     contents[contents.Count - 1] = contents[contents.Count - 1].TrimEnd(' ');
     warnings.AddRange(element.Warnings);
 }