ui refactoring

ui will now correctly update with current inline and block formattings
api was refactored to provide format function