Sort tags for consistent display

This ensures that the tag list will be consistent rather than based on the browser’s internal hash implementation. It also allows a custom override function to be configured when simple alphabetic sorting is not sufficient.

Closes #342
Closes #505