问题
How can I use a function that returns html within a string, inside a html template in google apps script ?
For example, here is my code.gs:
function doGet() {
return HtmlService.createTemplateFromFile('test').evaluate();
}
function getHtml(){
return "<b> hello there </b>";
}
and in my html file 'test.html' I have the following:
<html>
<?= getHtml() ?>
</html>
You will see the result is something like this:

How can I change this so it produces hello there in bold, without showing the tags ?
Many thanks
回答1:
Use force-printing:
<?!= getHtml() ?>
as explained here.
来源:https://stackoverflow.com/questions/14729845/google-apps-script-html-template-issue