parse.go
func appendChildren(parent element, rslt *result, lines []string, i *int, l int, src *source, opts *Options, f *File) error {
	for *i < l {
		// Fetch a line.
		ln := newLine(*i+1, lines[*i], opts, f)

		// Check if the line is a child of the parent.
		ok, err := ln.childOf(parent)

		if err != nil {
			return err
		}

		if !ok {
			return nil
		}

		child, err := newElement(ln, rslt, src, parent, opts)
		if err != nil {
			return err
		}

		parent.AppendChild(child)

		*i++

		if child.CanHaveChildren() {
			if err := appendChildren(child, rslt, lines, i, l, src, opts, f); err != nil {
				return err
			}
		}
	}

	return nil
}
func appendChildren(parent element, rslt *result, lines []string, i *int, l int, src *source, opts *Options, f *File) error {
	for *i < l {
		// Fetch a line.
		ln := newLine(*i+1, lines[*i], opts, f)

		// Check if the line is a child of the parent.
		ok, err := ln.childOf(parent)

		if err != nil {
			return err
		}

		if !ok {
			return nil
		}

		child, err := newElement(ln, rslt, src, parent, opts)
		if err != nil {
			return err
		}

		parent.AppendChild(child)

		*i++

		if child.CanHaveChildren() {
			if err := appendChildren(child, rslt, lines, i, l, src, opts, f); err != nil {
				return err
			}
		}
	}

	return nil
}
// appendChildren parses the lines and appends the children to the element.