You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: markdown.go
    path of file: ./repos/fyne/widget
    
    the code of the file until where you have to start completion: package widget

import (
	"io"
	"net/url"
	"strings"

	"github.com/yuin/goldmark"
	"github.com/yuin/goldmark/ast"
	"github.com/yuin/goldmark/renderer"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/storage"
)

// NewRichTextFromMarkdown configures a RichText widget by parsing the provided markdown content.
//
// Since: 2.1
func NewRichTextFromMarkdown(content string) *RichT
    
func addTextToSegment(text string, s RichTextSegment, node ast.Node) ast.WalkStatus {
	trimmed := strings.ReplaceAll(text, "\n", " ") // newline inside paragraph is not newline
	if trimmed == "" {
		return ast.WalkContinue
	}
	if t, ok := s.(*TextSegment); ok {
		next := node.(*ast.Text).NextSibling()
		if next != nil {
			if nextText, ok := next.(*ast.Text); ok {
				if nextText.Segment.Start > node.(*ast.Text).Segment.Stop { // detect presence of a trailing newline
					trimmed = trimmed + " "
				}
			}
		}

		t.Text = t.Text + trimmed
	}
	if link, ok := s.(*HyperlinkSegment); ok {
		link.Text = link.Text + trimmed
	}
	return 0
}