Suggestions on Extracting Highlights + Bold Text + Italic Text from $Text of a note

Question: Would there be a way to combine elements of String.highlights + this script from Sumner Gerard from here: Extract text with particular formatting - #8 by sumnerg

Tom