google-apps-script - 如何在 Google Apps jsdoc 描述中强制换行

标签 google-apps-script google-sheets google-docs jsdoc

我不知道如何在 Google Apps 脚本中正确显示此内容。我需要它在 jsdoc 输出中显示新行(例如,当函数工具提示窗口出现在电子表格函数中时。)我尝试过像
这样的 html,但它只是呈现为文本而不是换行符。

例如:

/**
 * Converts the prefixed value to the specified base.
 * Requires one of the following prefixes: 
 *    '0b' Base 2:   binary 
 *    '0q' Base 4:   quaternary 
 *    '0o' Base 8:   octal
 *    '0x' Base 16:  hexadecimal
 *
 * @param {string} Value The prefixed value to convert.
 * @param {number} To The base to convert to.
 * @return The converted base.
 * @customfunction
 */
function BASEP(Value, To) {

这只会呈现一个文本 block ,例如:

Summary:
  Converts the prefixed value to the specified base. Requires
  one of the following prefixes: 0b Base 2: binary 0q Base 4:
  quaternary 0o Base 8:  octal 0x Base 16:  hexadecimal

最佳答案

这个方法对我有用。在 markdown (或 StackOverflow)中,您需要有两个换行符(即额外的一个)来开始新行(或段落)。同样的方法适用于 JSDoc

/**
 * Converts the prefixed value to the specified base.
 * 
 * Requires one of the following prefixes:
 * 
 *    '0b' Base 2:   binary<br> 
 *    '0q' Base 4:   quaternary
 *    '0o' Base 8:   octal<
 *    '0x' Base 16:  hexadecimal
 * 
 */
async function test() {
  return;
}

证明:

原始案例

original

附加行:

new

ps

  • 在最新的 vscode 上的 Typescript + tslint + prettier 上进行了测试(不知道版本,全部已更新)。
  • 这是 Loopback 4 项目

关于google-apps-script - 如何在 Google Apps jsdoc 描述中强制换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28245463/

相关文章:

google-apps-script - 您无法删除工作表 Google Sheets 脚本上的所有行

javascript - 将谷歌脚本值传递给 html

javascript - 无法在谷歌文档文件中找到函数错误

google-apps-script - 将带有粗体部分的特定范围复制到另一个电子表格上的特定范围,同时保留粗体部分

sql - 将工作表名称添加为要在 Google 表格中查询的列

google-chrome - Chrome 开发工具快捷方式会覆盖 Google 文档快捷方式

嵌入可编辑的 Google Docs 电子表格,没有标题和工具栏

javascript - 用于匹配包含 ID 的工作表名称并使其可见的 Apps 脚本

google-apps-script - 使用 myImportRange 自定义电子表格函数 - TypeError : Cannot call method "split" of undefined

google-apps-script - 使用 Google Apps 脚本删除 Google 文档中的表格行