我需要能够使用Google App脚本在我的Google表单的帮助文本中插入超链接和换行符。都不可能。
对于我尝试过的链接(无效):
http://link.com/path
<a href='http://link.com/path'>http://link.com/path</a>
对于换行,我已经尝试过(没有效果):
\n
\\n
\n
我的代码如下:
function createForm() {
var form = FormApp.create('Amazon Open Source Project Classification');
form.setDescription("This form is for labeling open source projects using the project url and description with the following 4 categories:\n\n1) \
API - this is an API library that can only be used to access an Amazon Web Services (AWS) API\n2) EDUCATION - this is an educational project or example \
of how to use an AWS API\n3) GENERAL - this is a general purpose open source project with utility for the public\n4) DATASET - this is a dataset \
published by researchers as part of their researchz\n")
form.addMultipleChoiceItem()
.setTitle("What category does the project fall under?")
.setHelpText("<a href='http://github.com/alexa/alexa-skills-kit-sdk-for-nodejs'>http://github.com/alexa/alexa-skills-kit-sdk-for-nodejs</a>\n\nThe Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.")
.setChoiceValues(['API','EDUCATION', 'GENERAL', 'DATASET'])
Logger.log('Published URL: ' + form.getPublishedUrl());
Logger.log('Editor URL: ' + form.getEditUrl());
}
无法在该字段中设置超链接,因为方法setHelpText需要一个String参数,并且Forms UI不会将其解释为HTML。
但是,您可以使用组件here向Google的问题跟踪器Public Trackers > G Suite Developers > Apps Script
提交功能请求(因为这将用于Apps脚本FormApp Class)。