Using wiki markup to format html emails in Google Apps Script using Remy Sharp’s wiki2html

One of the first tutorials I did when starting with Google Apps Script was the Simple Mail Merge tutorial. Since then some of the Google Apps Script top contributors guest posted 4 ways to do Mail Merge using Google Apps Script. Today when I was trying to solve my own html email problem I decided a solution that best fitted my needs was using a slight variation of the Simple Mail Merge but letting the user use wiki markup to format the text.

Fortunately Remy Sharp has already produced a library for Wiki to HTML using JavaScript. As Google Apps Script uses the JavaScript protocol no changes to the code where required other than just dropping in the wiki2html function.

As well as sending the html email I wanted the old ‘having problems reading this email visit this online link’. To do this I published my spreadsheet as a service and built some basic UI Service wrapper and passed my wiki markup into a modified version of John Francis Workaround for HTML in Apps Script UIApp. Apps Script doesn’t allow you to chuck pieces of HTML markup at it and John’s code only turns paragraphs into text blocks. I needed inline hyperlinks as well so came up with this snippet which merges some of Remy Sharps code. I was going to take it further and add more wiki markup support for things like italics and bold but the InlineLabel escapes html (e.g. “ is rendered as " etc) so there didn’t seem to be a point.

Last updated by at .

1 Response to “Using wiki markup to format html emails in Google Apps Script using Remy Sharp’s wiki2html”


Comments are currently closed.

About

This blog is authored by Martin Hawksey Google+

JISC CETIS Learning Technology Advisor (OER Programme Support)
jisc cetis logo

The MASHezine (tabloid)

It's back! A tabloid edition of the latest posts in PDF format (complete with QR Codes). Click here to view the MASHezine

Preview powered by:
Bluga.net Webthumb

The MASHebook

You can also download this post as:

Subscribe to monthly email digest of posts

Loading...Loading...


Subscribe to per post email updates

Enter your email address:

Delivered by FeedBurner

Copyright License

Creative Commons Licence
This work is licensed under a Creative Commons Attribution 3.0 Unported License. CC-BY mhawksey

Privacy /Cookies

This blog uses Google Analytics (which makes use of 'cookie' technologies) to provide information on usage. Here's an overview of Google Analytics Privacy and how to opt-out (other 3rd party services like Twitter might also be tracking you via this site, but as far as possible I try and prevent this by removing official tweet buttons).

Badges

. . .