/// <summary> /// Initializes a new instance of <see cref="MdHeading"/> /// </summary> /// <param name="text">The text of the heading. Must not be null.</param> /// <param name="level">The heading's level. Value must be in the range [1,6]</param> public MdHeading(MdSpan text, int level) { if (level < 1 || level > 6) { throw new ArgumentOutOfRangeException(nameof(level), "Value must be in the range [1,6]"); } if (text == null) { throw new ArgumentNullException(nameof(text)); } if (text is MdSingleLineSpan singleLineSpan) { Text = singleLineSpan; } else { Text = new MdSingleLineSpan(text); } Level = level; AutoGeneratedId = HtmlUtilities.ToUrlSlug(Text.ToString()); Anchor = AutoGeneratedId; }
public void Visit(MdSingleLineSpan singleLineSpan) { PushNewNode(singleLineSpan); singleLineSpan.Content.Accept(this); PopNode(); }