Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML formatted text in Google Calendar Event description

Hi Google Calendar team.

We sync calendar for our clients using Google Calendar API. Event.description has always been in plain text. And is supposed to be plain text, right? But recently we started running into cases of html formatted text which our code is not prepared to handle.

There is actually a very long thread about new Google apps causing this: https://productforums.google.com/forum/#!topic/calendar/r3OC4cL53NQ

Can someone from Google API team please comment on the issue?

It's actually pretty funny. A Google Cloud team sent me an invitation today and the event description is html garbage in my Mac iCal. This is all because Google Calendar apps started writing html to the field that is treated as plain text by anyone using Google Calendar API.

Even the original iCalendar standard allowed only plain text as part of an event description. HTML markup, such as font attributes (bold, underline) and layout (div, table) was not allowed in the text description field.

like image 254
Alexey Avatar asked Mar 15 '18 18:03

Alexey


1 Answers

For what it is worth. I have been able to update the Google Calendar API (Google Events) description field with very basic HTML:

HTML headings <h1> to <h6>

Line Breaks <br>

Line Breaks <br>

Horizontal rule <hr>

I suspect others will work as well (my event js below).

let remarks = '<ul><li>Coffee</li><li>Tea</li><li>Milk</li></ul><br><hr><h2>h2 tag!</h2>'
            let event = {
                "description":
                '<hr> Super limited HTML!: ' + remarks,
                "colorId": colorID,
                "summary": SOtitle,
                "end": {
                    "dateTime": end,
                    "timeZone": $rootScope.app.timezone
                },
                "attendees": attendeesArrray,
                "sendUpdates": "all",

                "start": {
                    "dateTime": start,
                    'timeZone': timezone
      },
  };

enter image description here

like image 97
Fergus Avatar answered Dec 20 '22 13:12

Fergus