ability to use a function instead of a string for parameter 'html'

Added ability to use a function instead of a string for parameter 'html'.
And sorry for autoremove trailing spaces :)