Microsoft has started blocking execution of custom markup in calculated fields in SharePoint Online from June 13, 2017 onwards.
Workaround
- JS Link Approach – JSLink allows us to change the field formatting based on field values or custom logic. This approach may not work for calculated column and modern concept.
- DOM Manipulation at runtime using a script editor webpart – This is a temporary solution as Microsoft is recommending users to use modern features.
- SharePoint Framework Extension – This approach can be used only when we switch to modern concepts. We can make a ApplicationCustomizers using extension approach to derive a generic solution.
Temporary Fix for Classic Pages – DOM Manipulation at runtime
Sample Formula
Sample JavaScript Code to add in Script Editor WebPart