extractTextFromElement method
Returns the text, if any, from element
and its descendants.
Implementation
String? extractTextFromElement(md.Node element) {
return element is md.Element && (element.children?.isNotEmpty ?? false)
? element.children!
.map((md.Node e) =>
e is md.Text ? e.text : extractTextFromElement(e))
.join('')
: (element is md.Element && (element.attributes.isNotEmpty)
? element.attributes['alt']
: '');
}