Google-apps-script – How to force newlines in Google Apps jsdoc descriptions

google docsgoogle sheetsgoogle-apps-scriptjsdoc

I can't figure out how in a Google Apps Script to display this correctly. I need it to display new lines in the jsdoc output(e.g. when the function tooltip window comes up in a Spreadheet functions.) I have tried html like
however it is just rendered as text and not a line break.

For example:

/**
 * 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) {

This just renders a text blob like:

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

Best Answer

Here are a few ways to control the format of your jsdoc comments in Google Apps Script:

<pre>

/**
 * Converts the prefixed value to the specified base.
 * Requires one of the following prefixes: 
 * <pre>
 *    '0b' Base 2:   binary 
 *    '0q' Base 4:   quaternary 
 *    '0o' Base 8:   octal
 *    '0x' Base 16:  hexadecimal
 * </pre>
 *
 * @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) { }

<p> paragraphs

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

List

/**
 * Converts the prefixed value to the specified base.
 * Requires one of the following prefixes: 
 * <ul style="list-style: none;">
 *  <li> '0b' Base 2:   binary 
 *  <li> '0q' Base 4:   quaternary 
 *  <li> '0o' Base 8:   octal
 *  <li> '0x' Base 16:  hexadecimal
 * </ul>
 *
 * @param {string} Value The prefixed value to convert.
 * @param {number} To The base to convert to.
 * @return The converted base.
 * @customfunction
 */
function BASEP3(Value, To) { }

Table

/**
 * Converts the prefixed value to the specified base.
 * Requires one of the following prefixes: 
 * <table style="width:30%;">
 *  <tr><td>'0b'</td><td>Base 2:</td><td>binary</td></tr>
 *  <tr><td>'0q'</td><td>Base 4:</td><td>quaternary</td></tr>
 *  <tr><td>'0o'</td><td>Base 8:</td><td>octal</td></tr>
 *  <tr><td>'0x'</td><td>Base 16:</td><td>hexadecimal</td></tr>
 * </table>
 *
 * @param {string} Value The prefixed value to convert.
 * @param {number} To The base to convert to.
 * @return The converted base.
 * @customfunction
 */
function BASEP4(Value, To) { }