What to do about html in event descriptions?
Some applications will cope with the html, but there are other applications which do not. EG: Google calendar – does not faciliate html nor issue it in feed.
HTML in the description field is not explicitly forbidden, however it is probably not recommended. There is some provision for html to be explicitly allowed for, either:
- in the description using an ALTREP parameter,
- or in an ‘experiemental’ X field, X-ALT-DESC,
WordPress allows us to create events with html in them. So what to do when the ics feed is generated?
Retaining the html – two possibilties:
Link to the html representation:
DESCRIPTION;ALTREP="http://www.example.com/somepath/":This is an example description.
Provide separate field with html representation:
Outlook will recognise:
X-ALT-DESC;FMTTYPE=text/html:<p>This is an example description.</p>
This update does both, as well of course ,as stripping the html from the description field in the ics file. This means images will be stripped too (only for the feed – do not panic!)
More information for the technically minded
- Microsft on X_ALT_DESC http://msdn.microsoft.com/en-us/library/ee237480(v=exchg.80).aspx
- Discussion: http://www.advancedintellect.com/post/2011/09/28/iCalendar-Using-HTML-in-the-iCalendar-Description-Field.aspx
- Discussion: http://stackoverflow.com/questions/854036/html-in-ical-attachment
- Specification (text format) http://www.ietf.org/rfc/rfc5545.txt
- Older Specification (easier to link to direct section) http://www.kanzaki.com/docs/ical/altrep.html