diff --git a/package-lock.json b/package-lock.json index 329c3a37..7c1c45c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "devDependencies": { "@types/node": "^15.12.4", "@types/vscode": "1.30.0", + "chalk": "4.1.2", "eslint": "^7.5.0", "node-loader": "^2.0.0", "prettier": "^2.0.5", @@ -51,6 +52,47 @@ "js-tokens": "^4.0.0" } }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.3.tgz", @@ -149,6 +191,17 @@ "node": ">=10" } }, + "node_modules/@hubspot/cli-lib/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@hubspot/cli-lib/node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -185,6 +238,32 @@ "node": ">=0.10.0" } }, + "node_modules/@hubspot/cli-lib/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@hubspot/cli-lib/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@hubspot/cli-lib/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, "node_modules/@hubspot/cli-lib/node_modules/fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -1008,38 +1087,42 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "node_modules/chalk": { - "version": "2.4.2", - "license": "MIT", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chalk/node_modules/ansi-styles": { - "version": "3.2.1", - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, + "node_modules/chalk/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/chalk/node_modules/color-convert": { - "version": "1.9.3", - "license": "MIT", + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "dependencies": { - "color-name": "1.1.3" + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/chalk/node_modules/color-name": { - "version": "1.1.3", - "license": "MIT" - }, "node_modules/chokidar": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", @@ -1481,7 +1564,8 @@ }, "node_modules/escape-string-regexp": { "version": "1.0.5", - "license": "MIT", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "engines": { "node": ">=0.8.0" } @@ -1581,21 +1665,6 @@ "node": ">=4" } }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/eslint/node_modules/debug": { "version": "4.3.1", "dev": true, @@ -1620,30 +1689,11 @@ "node": ">=10" } }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/eslint/node_modules/ms": { "version": "2.1.2", "dev": true, "license": "MIT" }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/espree": { "version": "7.3.1", "dev": true, @@ -2269,7 +2319,8 @@ }, "node_modules/has-flag": { "version": "3.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "engines": { "node": ">=4" } @@ -4145,7 +4196,8 @@ }, "node_modules/supports-color": { "version": "5.5.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dependencies": { "has-flag": "^3.0.0" }, @@ -4353,43 +4405,6 @@ "webpack": "^5.0.0" } }, - "node_modules/ts-loader/node_modules/chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/ts-loader/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ts-loader/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -4871,6 +4886,43 @@ "@babel/helper-validator-identifier": "^7.14.0", "chalk": "^2.0.0", "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + } } }, "@discoveryjs/json-ext": { @@ -4942,6 +4994,14 @@ "unixify": "1.0.0" }, "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, "argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -4974,6 +5034,29 @@ } } }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -5622,27 +5705,29 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "chalk": { - "version": "2.4.2", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "requires": { - "color-convert": "^1.9.0" - } + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true }, - "color-convert": { - "version": "1.9.3", + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "requires": { - "color-name": "1.1.3" + "has-flag": "^4.0.0" } - }, - "color-name": { - "version": "1.1.3" } } }, @@ -5982,7 +6067,9 @@ "dev": true }, "escape-string-regexp": { - "version": "1.0.5" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" }, "eslint": { "version": "7.25.0", @@ -6027,14 +6114,6 @@ "v8-compile-cache": "^2.0.3" }, "dependencies": { - "chalk": { - "version": "4.1.1", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, "debug": { "version": "4.3.1", "dev": true, @@ -6046,20 +6125,9 @@ "version": "2.0.0", "dev": true }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, "ms": { "version": "2.1.2", "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, @@ -6540,7 +6608,9 @@ } }, "has-flag": { - "version": "3.0.0" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" }, "has-value": { "version": "1.0.0", @@ -7883,6 +7953,8 @@ }, "supports-color": { "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "requires": { "has-flag": "^3.0.0" } @@ -8029,33 +8101,6 @@ "enhanced-resolve": "^5.0.0", "micromatch": "^4.0.0", "semver": "^7.3.4" - }, - "dependencies": { - "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "tunnel-agent": { diff --git a/package.json b/package.json index 62477324..60e09daf 100644 --- a/package.json +++ b/package.json @@ -199,6 +199,7 @@ "devDependencies": { "@types/node": "^15.12.4", "@types/vscode": "1.30.0", + "chalk": "4.1.2", "eslint": "^7.5.0", "node-loader": "^2.0.0", "prettier": "^2.0.5", diff --git a/scripts/generate.js b/scripts/generate.js index 827c57ba..24287ae5 100644 --- a/scripts/generate.js +++ b/scripts/generate.js @@ -1,6 +1,9 @@ const fetch = require('node-fetch'); const fs = require('fs-extra'); const path = require('path'); +const chalk = require('chalk'); + +const SNIPPET_TYPES = ['expTests', 'filters', 'functions', 'tags']; const PREFIX = { expTests: '', @@ -9,19 +12,6 @@ const PREFIX = { tags: '~', }; -// Skip snippet generation if format is incompatible -const SKIP_SNIPPET_GENERATION = [ - 'set', - 'for', - 'if', - 'flip', - 'import', - 'include', - 'from', - 'do', - 'module_attribute', -]; - const OMIT_SNIPPET = [ 'dnd_area', 'dnd_section', @@ -30,11 +20,15 @@ const OMIT_SNIPPET = [ 'dnd_module', ]; -const fetchHubldocs = async () => { - const HUBLDOC_ENDPOINT = 'https://api.hubspot.com/cos-rendering/v1/hubldoc'; - const response = await fetch(HUBLDOC_ENDPOINT); +const HUBLDOC_ENDPOINT = 'https://api.hubspot.com/cos-rendering/v1/hubldoc'; - return response.json(); +const fetchHubldocs = async () => { + try { + const res = await fetch(HUBLDOC_ENDPOINT); + return await res.json(); + } catch (err) { + console.error(chalk.red(`Error: ${err.message}`)); + } }; const buildSnippetBody = ( @@ -101,34 +95,35 @@ const buildSnippetDescription = (docEntry) => { return description; }; -const getFirstDefaultSnippet = (docEntry) => { - return docEntry.snippets.shift().code; -}; - -const createSnippet = (docEntry, type) => { +const createSnippet = (docEntry, type, existingSnippet) => { if (OMIT_SNIPPET.includes(docEntry.name)) { return; } - let snippetEntry = { + return { body: [ - SKIP_SNIPPET_GENERATION.includes(docEntry.name) - ? getFirstDefaultSnippet(docEntry) - : buildSnippetBody(docEntry, type), + existingSnippet ? existingSnippet : buildSnippetBody(docEntry, type), ], description: buildSnippetDescription(docEntry, type), prefix: PREFIX[type] + docEntry.name, }; - - return snippetEntry; }; const createFile = async (data, type) => { - const docEntries = Object.values(data); + const snippetData = data[type]; + const docEntries = Object.values(snippetData); let snippets = {}; for (let entry of docEntries) { - snippets[entry['name']] = createSnippet(entry, type); + if (type === 'tags' && data.codeSnippets[entry['name']]) { + snippets[entry['name']] = createSnippet( + entry, + type, + data.codeSnippets[entry['name']] + ); + } else { + snippets[entry['name']] = createSnippet(entry, type); + } } try { @@ -142,17 +137,16 @@ const createFile = async (data, type) => { }); console.log(`Wrote ${filepath} with ${snippetCount} snippets`); - } catch (e) { - console.log(e); + } catch (err) { + console.error(chalk.red(`Error: ${err.message}`)); } }; const createSnippetFiles = async () => { const data = await fetchHubldocs(); - const snippetTypes = Object.keys(data); - for (let type of snippetTypes) { - createFile(data[type], type); + for (let type of SNIPPET_TYPES) { + createFile(data, type); } }; diff --git a/snippets/auto_gen/hubl_filters.json b/snippets/auto_gen/hubl_filters.json index f6b2dc7e..14dca4c6 100644 --- a/snippets/auto_gen/hubl_filters.json +++ b/snippets/auto_gen/hubl_filters.json @@ -13,6 +13,13 @@ "description": "adds a number to the existing value\nParameters:\n- addend(number) The number added to the base number", "prefix": "|add" }, + "allow_snake_case": { + "body": [ + "|allow_snake_case" + ], + "description": "Allow keys on the provided camelCase map to be accessed using snake_case", + "prefix": "|allow_snake_case" + }, "attr": { "body": [ "|attr('${1:name}')" @@ -162,9 +169,9 @@ }, "escape_jinjava": { "body": [ - "|escape_jinjava" + "|escape_jinjava(${1:all_braces})" ], - "description": "Converts the characters { and } in string s to Jinjava-safe sequences. Use this filter if you need to display text that might contain such characters in Jinjava. Marks return value as markup string.", + "description": "Converts the characters { and } in string s to Jinjava-safe sequences. Use this filter if you need to display text that might contain such characters in Jinjava. Marks return value as markup string.\nParameters:\n- all_braces(boolean) Whether to only escape all curly braces or just when there are default expression, tag, or comment marks", "prefix": "|escape_jinjava" }, "escapejs": { @@ -230,6 +237,13 @@ "description": "Formats a given number as a currency based on the locale and currency code passed in as a parameter. \nParameters:\n- locale(String) Locale in which to format the currency. Any Java locale language tag can be passed as a parameter. The default is the page's locale.Format : ISO639LanguageCodeInLowercase-ISO3166CountryCodeInUppercase\n- currency_code(String) The ISO 4217 code of the currency. The default is the portal's default currency\n- use_default decimal digits(String) A boolean input that determines if formatter needs to use default decimal digits of the currency code. The default is false.\n- extend_Decimal Digits To Value Precision(String) A boolean input that determines if formatter needs to use the number of decimal digits from the given value. If the number of decimal digits from the input value is greater than the default number of decimal digits of the currency, use the number of decimal digits from the input value. Otherwise use the currency's default. The default is false.", "prefix": "|format_currency" }, + "format_currency_value": { + "body": [ + "|format_currency_value('${1:locale}', '${2:currency}', ${3:minDecimalDigits}, ${4:maxDecimalDigits})" + ], + "description": "Formats a given number as a currency.\nParameters:\n- locale(String) The language tag for the locale to use. Defaults to the page's locale.\nFormat: ISO639LanguageCodeInLowercase-ISO3166CountryCodeInUppercase\n- currency(String) The ISO 4217 code of the currency to use. Defaults to the portal's default currency.\n- minDecimalDigits(integer) The minimum number of decimal digits to use. Defaults to the currency's default number of decimal digits.\n- maxDecimalDigits(integer) The maximum number of decimal digits to use. Defaults to the currency's default number of decimal digits.", + "prefix": "|format_currency_value" + }, "format_date": { "body": [ "|format_date('${1:format}', '${2:timeZone}', '${3:locale}')" @@ -244,6 +258,13 @@ "description": "Formats both the date and time components of a date object\nParameters:\n- format(String) The format to use. One of 'short', 'medium', 'long', 'full', or a custom pattern following Unicode LDML\nhttps://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns\n- timeZone(String) Time zone of the output date in IANA TZDB format\nhttps://data.iana.org/time-zones/tzdb/\n- locale(String) The locale to use for locale-aware formats", "prefix": "|format_datetime" }, + "format_number": { + "body": [ + "|format_number('${1:locale}', ${2:max decimal precision})" + ], + "description": "Formats a given number based on the locale passed in as a parameter.\nParameters:\n- locale(String) Locale in which to format the number. The default is the page's locale.\n- max_decimal precision(number) A number input that determines the decimal precision of the formatted value. If the number of decimal digits from the input value is less than the decimal precision number, use the number of decimal digits from the input value. Otherwise, use the decimal precision number. The default is the number of decimal digits from the input value.", + "prefix": "|format_number" + }, "format_time": { "body": [ "|format_time('${1:format}', '${2:timeZone}', '${3:locale}')" diff --git a/snippets/auto_gen/hubl_functions.json b/snippets/auto_gen/hubl_functions.json index 12b598c6..2b3b60f4 100644 --- a/snippets/auto_gen/hubl_functions.json +++ b/snippets/auto_gen/hubl_functions.json @@ -36,9 +36,9 @@ }, "blog_popular_posts": { "body": [ - "blog_popular_posts(${1:selected_blog}, ${2:limit}, ${3:tag_slug}, ${4:time_frame})" + "blog_popular_posts(${1:selected_blog}, ${2:limit}, ${3:tag_slug}, ${4:time_frame}, ${5:logical_operator})" ], - "description": "Returns a sequence of blog post objects for the specified blog, sorted by most popular first\nParameters:\n- selected_blog(blog id or 'default') Specifies which blog to use\n- limit(number) Specifies the number of posts to add to the sequence up to a limit of 200\n- tag_slug(list) Optional list of tags to filter posts by\n- time_frame(choice) Optional timeframe to filter posts by (must be one of 'popular_all_time', 'popular_past_year', 'popular_past_six_months', 'popular_past_month')", + "description": "Returns a sequence of blog post objects for the specified blog, sorted by most popular first\nParameters:\n- selected_blog(blog id or 'default') Specifies which blog to use\n- limit(number) Specifies the number of posts to add to the sequence up to a limit of 200\n- tag_slug(list) Optional list of tags to filter posts by\n- time_frame(choice) Optional timeframe to filter posts by (must be one of 'popular_all_time', 'popular_past_year', 'popular_past_six_months', 'popular_past_month')\n- logical_operator(string) Logical operator which, when tag_slug is a list, specifies how to logically filter on the slugs. Must be one of 'AND', 'OR'", "prefix": "~blog_popular_posts" }, "blog_post_archive_url": { @@ -71,9 +71,9 @@ }, "blog_recent_tag_posts": { "body": [ - "blog_recent_tag_posts(${1:selected_blog}, ${2:tag_slug}, ${3:limit})" + "blog_recent_tag_posts(${1:selected_blog}, ${2:tag_slug}, ${3:limit}, ${4:logical_operator})" ], - "description": "Returns a sequence of blog post objects for the specified blog, for the specified tag, sorted by most recent first\nParameters:\n- selected_blog(blog id or 'default') Specifies which blog to use\n- tag_slug(tag slug) Specifies which tag to filter on\n- limit(number) Specifies the number of posts to add to the sequence", + "description": "Returns a sequence of blog post objects for the specified blog, for the specified tag, sorted by most recent first\nParameters:\n- selected_blog(blog id or 'default') Specifies which blog to use\n- tag_slug(tag slug) Specifies which tag to filter on\n- limit(number) Specifies the number of posts to add to the sequence\n- logical_operator(string) Logical operator which, when tag_slug is a list, specifies how to logically filter on the slugs. Must be one of 'AND', 'OR'", "prefix": "~blog_recent_tag_posts" }, "blog_recent_topic_posts": { diff --git a/snippets/auto_gen/hubl_tags.json b/snippets/auto_gen/hubl_tags.json index 7d30d497..cb61233c 100644 --- a/snippets/auto_gen/hubl_tags.json +++ b/snippets/auto_gen/hubl_tags.json @@ -1,252 +1,252 @@ { "block": { "body": [ - "{% block 'my_block' \n\tblock_name='${1:block_name}'%}\n\n{% endblock %}" + "{% block ${1:name} %}\n$0\n{% endblock $1 %}" ], "description": "Blocks are regions in a template which can be overridden by child templates\nParameters:\n- block_name(String) A unique name for the block that should be used in both the parent and child template", "prefix": "~block" }, "blog_comments": { "body": [ - "{% blog_comments 'my_blog_comments' \n\tselect_blog='${1:select_blog}', \n\tlimit='${2:limit}', \n\tskip_css='${3:skip_css}'%}" + "{% blog_comments select_blog=\"${1:select_blog}\" limit=\"${2:limit}\" skip_css=\"${3:skip_css}\" %}" ], "description": "Renders the blog comments embed tag\nParameters:\n- select_blog('default' or blog id) Species which blog is connected to the comments embed\n- limit(number) Sets maximum number of comments\n- skip_css(bool) ", "prefix": "~blog_comments" }, "blog_social_sharing": { "body": [ - "{% blog_social_sharing 'my_blog_social_sharing' \n\tselect_blog='${1:select_blog}', \n\tdowngrade_shared_url='${2:downgrade_shared_url}'%}" + "{% blog_social_sharing select_blog=\"${1:select_blog}\" downgrade_shared_url=\"${2:downgrade_shared_url}\" %}" ], "description": "Blog social sharing module\nParameters:\n- select_blog('default' or blog id) Species which blog is connected to the share counters\n- downgrade_shared_url(boolean) Use http in the url sent to the social media networks. Used to preserve counts when upgrading domains to https only.", "prefix": "~blog_social_sharing" }, "blog_subscribe": { "body": [ - "{% blog_subscribe 'my_blog_subscribe' \n\tselect_blog='${1:select_blog}', \n\ttitle='${2:title}', \n\tno_title='${3:no_title}', \n\tresponse_message='${4:response_message}', \n\theading_level='${5:heading_level}', \n\tedit_form_link='${6:edit_form_link}'%}" + "{% blog_subscribe select_blog=\"${1:select_blog}\" title=\"${2:title}\" no_title=\"${3:no_title}\" response_message=\"${4:response_message}\" heading_level=\"${5:heading_level}\" edit_form_link=\"${6:edit_form_link}\" %}" ], "description": "Blog subscription module\nParameters:\n- select_blog('default' or blog id) Selects which blog subscription form to render\n- title(String) Defines text in a tag title above the subscribe form\n- no_title(boolean) If True, the tag above the title is removed\n- response_message(String) Defines the inline thank-you message that is rendered when a user submits a form\n- heading_level(String) Defines the heading level of the title\n- edit_form_link(String) Generates a link that allows users to click through to the corresponding Form editor screen", "prefix": "~blog_subscribe" }, "boolean": { "body": [ - "{% boolean 'my_boolean' \n\tvalue='${1:value}'%}" + "{% boolean '${1:name}' \n\tvalue='${2|false,true}'%}" ], "description": "A boolean option\nParameters:\n- value(boolean) Determines whether the checkbox is checked or unchecked", "prefix": "~boolean" }, "call": { "body": [ - "{% call 'my_call' %}\n\n{% endcall %}" + "{% call ${1:macro_name}(${2:argument_names}) %}\n$0\n{% endcall %}" ], "description": "In some cases it can be useful to pass a macro to another macro. For this purpose you can use the special call block.", "prefix": "~call" }, "choice": { "body": [ - "{% choice 'my_choice' \n\tchoices='${1:choices}', \n\tvalue='${2:value}'%}" + "{% choice '${1:name}' \n\tchoices='${2:choices}', \n\tvalue='${3:value}' %}" ], "description": "A list of options\nParameters:\n- choices(String) Comma-separated list of values, or list of value-label pairs\n- value(String) The default field value for the dropdown", "prefix": "~choice" }, "color": { "body": [ - "{% color 'my_color' \n\tcolor='${1:color}'%}" + "{% color '${1:name}' \n\tcolor='${2:color}'%}" ], "description": "A color picker module\nParameters:\n- color(String) A default HEX color value for the color picker module", "prefix": "~color" }, "content_attribute": { "body": [ - "{% content_attribute 'my_content_attribute' %}\n\n{% end_content_attribute %}" + "{% content_attribute '${1:name}' %}\n\n{% end_content_attribute %}" ], "description": "Sets default content in an attribute of the content object, such as content.email_body", "prefix": "~content_attribute" }, "cta": { "body": [ - "{% cta 'my_cta' \n\tembed_code='${1:embed_code}', \n\tfull_html='${2:full_html}', \n\timage_src='${3:image_src}', \n\timage_editor='${4:image_editor}', \n\tguid='${5:guid}', \n\timage_html='${6:image_html}', \n\timage_email='${7:image_email}'%}" + "{% cta embed_code=\"${1:embed_code}\" full_html=\"${2:full_html}\" image_src=\"${3:image_src}\" image_editor=\"${4:image_editor}\" guid=\"${5:guid}\" image_html=\"${6:image_html}\" image_email=\"${7:image_email}\" %}" ], "description": "Renders a CTA module\nParameters:\n- embed_code(String) The embed code for the CTA\n- full_html(String) The embed code for the CTA. Same as embed_code\n- image_src(String) Image src url that defines the preview image in the content editor\n- image_editor(String) Markup for the image editor preview\n- guid(String) The unique ID number of the default CTA\n- image_html(String) CTA image HTML without the CTA script\n- image_email(String) Email-friendly version of the CTA code", "prefix": "~cta" }, "custom_widget": { "body": [ - "{% custom_widget 'my_custom_widget' \n\twidget_definition='${1:widget_definition}', \n\twidget_name='${2:widget_name}'%}" + "{% custom_widget \"${1:name}\" widget_name=\"${2:widget_name}\", label=\"${3:label}\" %}" ], "description": "A custom module\nParameters:\n- widget_definition(json object) \n- widget_name(String) Specifies the internal Design Manager name of the custom module that you would like to render", "prefix": "~custom_widget" }, "cycle": { "body": [ - "{% cycle 'my_cycle' \n\tstring_to_print='${1:string_to_print}'%}" + "{% cycle '${1:string_to_print}' %}" ], "description": "The cycle tag can be used within a for loop to cycle through a series of string values and print them with each iteration\nParameters:\n- string_to_print(String) A comma separated list of strings to print with each interation. The list will repeat if there are more iterations than string parameter values.", "prefix": "~cycle" }, "do": { "body": [ - "{% do list.append('value 2') %}" + "{% do ${1:expr} %}" ], "description": "Evaluates expression without printing out result.", "prefix": "~do" }, "email_each": { "body": [ - "{% email_each 'my_email_each' \n\tlist='${1:list}', \n\titem='${2:item}'%}\n\n{% endemail_each %}" + "{% email_each list=\"${1:list}\" item=\"${2:item}\" %}\n{% endemail_each %}" ], "description": "Allows looping over a list value in an email where a for loop would not work. Use \"item.\" to access the current element of the list.\nParameters:\n- list(String) \n- item(String) ", "prefix": "~email_each" }, "email_flex_area": { "body": [ - "{% email_flex_area 'my_email_flex_area' \n\tname='${1:name}', \n\tno_wrapper='${2:no_wrapper}', \n\textra_classes='${3:extra_classes}'%}" + "{% email_flex_area name=\"${1:name}\" no_wrapper=\"${2:no_wrapper}\" extra_classes=\"${3:extra_classes}\" %}" ], "description": "An email flexible area tag is a widget container which renders its contained widgets in a box grid, \nwith an email friendly table-based layout.\n\nThe layout schema is defined in a JSON structure at the content level; these tags are always empty\nin their declaring templates.\nParameters:\n- name(String) \n- no_wrapper(boolean) \n- extra_classes(String) ", "prefix": "~email_flex_area" }, "email_simple_subscription": { "body": [ - "{% email_simple_subscription 'my_email_simple_subscription' \n\theader='${1:header}', \n\tsubheader='${2:subheader}', \n\tinput_help_text='${3:input_help_text}', \n\tbutton_text='${4:button_text}', \n\tinput_placeholder='${5:input_placeholder}'%}" + "{% email_simple_subscription header=\"${1:header}\" subheader=\"${2:subheader}\" input_help_text=\"${3:input_help_text}\" button_text=\"${4:button_text}\" input_placeholder=\"${5:input_placeholder}\" %}" ], "description": "Simple email unsubscribe form\nParameters:\n- header(String) Renders text in an h1 tag above the unsubscribe form\n- subheader(String) Renders text in an h2 tag above the unsubscribe form below the h1\n- input_help_text(String) Renders help text in an h3 tag above your email unsubscribe form field\n- button_text(String) Changes the text of the unsubscribe form submit button\n- input_placeholder(String) Adds placeholder text within the email address form field", "prefix": "~email_simple_subscription" }, "email_subscriptions": { "body": [ - "{% email_subscriptions 'my_email_subscriptions' \n\theader='${1:header}', \n\tsubheader_text='${2:subheader_text}', \n\tunsubscribe_single_text='${3:unsubscribe_single_text}', \n\tunsubscribe_all_text='${4:unsubscribe_all_text}', \n\tunsubscribe_all_unsubbed_text='${5:unsubscribe_all_unsubbed_text}', \n\tunsubscribe_all_option='${6:unsubscribe_all_option}', \n\tbutton_text='${7:button_text}', \n\tresubscribe_button_text='${8:resubscribe_button_text}'%}" + "{% email_subscriptions header=\"${1:header}\" subheader_text=\"${2:subheader_text}\" unsubscribe_single_text=\"${3:unsubscribe_single_text}\" unsubscribe_all_text=\"${4:unsubscribe_all_text}\" unsubscribe_all_unsubbed_text=\"${5:unsubscribe_all_unsubbed_text}\" unsubscribe_all_option=\"${6:unsubscribe_all_option}\" button_text=\"${7:button_text}\" resubscribe_button_text=\"${8:resubscribe_button_text}\" %}" ], "description": "Email subscription preferences form\nParameters:\n- header(String) Renders text in an h1 tag above the subscription preferences form\n- subheader_text(String) Populates text below the heading above the unsubscribe preferences\n- unsubscribe_single_text(String) Renders text in a

above the subscription options\n- unsubscribe_all_text(String) Renders text in a

above the unsubscribe from all emails checkbox input\n- unsubscribe_all_unsubbed_text(String) Populates text within a

that renders, if a contact is currently unsubscribed from all emails\n- unsubscribe_all_option(String) Sets the text next to the unsubscribe from all emails checkbox input\n- button_text(String) Sets the text of the submit button that updates subscription preferences\n- resubscribe_button_text(String) Sets the text of the submit button for when contacts are resubscribing", "prefix": "~email_subscriptions" }, "email_subscriptions_confirmation": { "body": [ - "{% email_subscriptions_confirmation 'my_email_subscriptions_confirmation' \n\theader='${1:header}', \n\tsubheader_text='${2:subheader_text}', \n\tunsubscribe_all_success='${3:unsubscribe_all_success}', \n\tsubscription_update_success='${4:subscription_update_success}'%}" + "{% email_subscriptions_confirmation header=\"${1:header}\" subheader_text=\"${2:subheader_text}\" unsubscribe_all_success=\"${3:unsubscribe_all_success}\" subscription_update_success=\"${4:subscription_update_success}\" %}" ], "description": "Email unsubscribe form\nParameters:\n- header(String) Renders text in an h1 tag above the unsubscribe form\n- subheader_text(String) Populates text above the confirmation message\n- unsubscribe_all_success(String) Sets the text that will display when someone unsubscribes from all email communications\n- subscription_update_success(String) Sets the text when a recipient updates his or her subscription preferences", "prefix": "~email_subscriptions_confirmation" }, "extends": { "body": [ - "{% extends 'my_extends' \n\tpath='${1:path}'%}" + "{% extends '${1:path}' %}" ], "description": "Template inheritance allows you to build a base “skeleton” template that contains all the common elements of your site and defines blocks that child templates can override.\nParameters:\n- path(String) Design Manager file path to parent template", "prefix": "~extends" }, "flip": { "body": [ - "{% flip val_true %}\nworld\n{% with %}\nhello\n{% endflip %}" + "{% flip %}\n{% endflip %}" ], "description": "Outputs the first and second block in specified or reverse order depending on the evaluation of the condition", "prefix": "~flip" }, "follow_me": { "body": [ - "{% follow_me 'my_follow_me' \n\ttitle='${1:title}', \n\tmodule_title_tag='${2:module_title_tag}'%}" + "{% follow_me title=\"${1:title}\" module_title_tag=\"${2:module_title_tag}\" %}" ], "description": "Deprecated: Use follow me default module instead.\nParameters:\n- title(String) Prints an h3 heading tag above the follow me module\n- module_title_tag(String) Specifies a heading tag h1-h6 to use for the module title", "prefix": "~follow_me" }, "for": { "body": [ - "{% for item in items %}\n {{ item }}\n{% endfor %}" + "{% for ${1:items} in ${2:list} %}\n$0\n{% endfor %}" ], "description": "Outputs the inner content for each item in the given iterable\nParameters:\n- items_to_iterate(String) Specifies the name of a single item in the sequence or dict.", "prefix": "~for" }, "form": { "body": [ - "{% form 'my_form' \n\tform_key='${1:form_key}', \n\tform_to_use='${2:form_to_use}', \n\ttitle='${3:title}', \n\tno_title='${4:no_title}', \n\tform_follow_ups_follow_up_type='${5:form_follow_ups_follow_up_type}', \n\tsimple_email_for_live_id='${6:simple_email_for_live_id}', \n\tsimple_email_for_buffer_id='${7:simple_email_for_buffer_id}', \n\tfollow_up_type_simple='${8:follow_up_type_simple}', \n\tfollow_up_type_automation='${9:follow_up_type_automation}', \n\tsimple_email_campaign_id='${10:simple_email_campaign_id}', \n\tform_follow_ups_workflow_id='${11:form_follow_ups_workflow_id}', \n\tresponse_redirect_url='${12:response_redirect_url}', \n\tresponse_redirect_id='${13:response_redirect_id}', \n\tresponse_response_type='${14:response_response_type}', \n\tresponse_message='${15:response_message}', \n\tnotifications_are_overridden='${16:notifications_are_overridden}', \n\tnotifications_override_guid_buffer='${17:notifications_override_guid_buffer}', \n\tnotifications_override_guid='${18:notifications_override_guid}', \n\tnotifications_override_email_addresses='${19:notifications_override_email_addresses}', \n\tnotifications_override_user_ids='${20:notifications_override_user_ids}', \n\tgotowebinar_webinar_key='${21:gotowebinar_webinar_key}', \n\tsfdc_campaign='${22:sfdc_campaign}', \n\toverride_styles='${23:override_styles}'%}" + "{% form form_key=\"${1:form_key}\" form_to_use=\"${2:form_to_use}\" title=\"${3:title}\" no_title=\"${4:no_title}\" form_follow_ups_follow_up_type=\"${5:form_follow_ups_follow_up_type}\" simple_email_for_live_id=\"${6:simple_email_for_live_id}\" simple_email_for_buffer_id=\"${7:simple_email_for_buffer_id}\" follow_up_type_simple=\"${8:follow_up_type_simple}\" follow_up_type_automation=\"${9:follow_up_type_automation}\" simple_email_campaign_id=\"${10:simple_email_campaign_id}\" form_follow_ups_workflow_id=\"${11:form_follow_ups_workflow_id}\" response_redirect_url=\"${12:response_redirect_url}\" response_redirect_id=\"${13:response_redirect_id}\" response_response_type=\"${14:response_response_type}\" response_message=\"${15:response_message}\" notifications_are_overridden=\"${16:notifications_are_overridden}\" notifications_override_guid_buffer=\"${17:notifications_override_guid_buffer}\" notifications_override_guid=\"${18:notifications_override_guid}\" notifications_override_email_addresses=\"${19:notifications_override_email_addresses}\" notifications_override_user_ids=\"${20:notifications_override_user_ids}\" gotowebinar_webinar_key=\"${21:gotowebinar_webinar_key}\" sfdc_campaign=\"${22:sfdc_campaign}\" override_styles=\"${23:override_styles}\" %}" ], "description": "Insert one of the forms created in the Form Manager\nParameters:\n- form_key(String) A unique id to target this form instance on the page\n- form_to_use(String) The form ID of the form to render by default\n- title(String) Populates an h3 header tag above the form\n- no_title(boolean) If True, the h3 tag above the title is removed.\n- form_follow_ups_follow_up_type(enum no_action|simple|automation) Specifies follow up action\n- simple_email_for_live_id(number) Specifies the ID of the simple follow-up email for the live page\n- simple_email_for_buffer_id(number) Specifies the ID of the simple follow-up email for the auto-save version of a page\n- follow_up_type_simple(boolean) If true, enables a simple follow-up email\n- follow_up_type_automation(boolean) If true, enrolls submissions in a workflow\n- simple_email_campaign_id(number) Specifies the ID of the simple follow-up email\n- form_follow_ups_workflow_id(number) Specifies the ID of the follow-up workflow\n- response_redirect_url(String) If redirecting to an external page, this parameter specifies the URL to redirect to\n- response_redirect_id(number) If redirecting to HubSpot hosted page, this parameter specifies the page ID of that page\n- response_response_type(enum inline|redirect) Determines whether to redirect to another page or to display an inline thank you message on submission\n- response_message(String) Sets an inline thank you message\n- notifications_are_overridden(boolean) If True, the form will send notifications to specified addresses selected in the notifications_override_email_addresses\n- notifications_override_guid_buffer(String) ID of override settings in auto-save version of page\n- notifications_override_guid(String) ID of override settings in live version of page\n- notifications_override_email_addresses(JSON list) (Deprecated) These email addresses will override the email notification settings set in the form\n- notifications_override_user_ids(JSON list) The user IDs to override email addresses for the email notification settings set in the form\n- gotowebinar_webinar_key(String) Specifies the GoToWebinar webinar to enroll contacts who submit the form into\n- sfdc_campaign(String) Specifies the Salesforce campaign to enroll contacts who submit the form into\n- override_styles(json object) Override config for forms styles", "prefix": "~form" }, "from": { "body": [ - "{% macro header(tag, title_text) %}\n

<{{ tag }}>{{ title_text }}
\n{% endmacro %}\n{% macro footer(tag, footer_text) %}\n
<{{ tag }}>{{ footer_text }}
\n{% endmacro %}" + "{% from '${1:path}' import ${2:macro_name} %}" ], "description": "Alternative to the import tag that lets you import and use specific macros from one template to another\nParameters:\n- path(String) Design Manager path to file to import from\n- macro_name(String) Name of macro or comma separated macros to import (import macro_name)", "prefix": "~from" }, "gallery": { "body": [ - "{% gallery 'my_gallery' \n\tslides='${1:slides}', \n\tloop_slides='${2:loop_slides}', \n\tnum_seconds='${3:num_seconds}', \n\tshow_pagination='${4:show_pagination}', \n\tsizing='${5:sizing}', \n\tauto_advance='${6:auto_advance}', \n\ttransition='${7:transition}', \n\tcaption_position='${8:caption_position}', \n\tdisplay_mode='${9:display_mode}', \n\tlightboxRows='${10:lightboxRows}'%}" + "{% gallery '${1:name}' \n\tslides='${2:slides}', \n\tloop_slides='${3:loop_slides}', \n\tnum_seconds='${4:num_seconds}', \n\tshow_pagination='${5:show_pagination}', \n\tsizing='${6:sizing}', \n\tauto_advance='${7:auto_advance}', \n\ttransition='${8:transition}', \n\tcaption_position='${9:caption_position}', \n\tdisplay_mode='${10:display_mode}', \n\tlightboxRows='${11:lightboxRows}'%}" ], "description": "Gallery\nParameters:\n- slides(json list) A JSON list of the default caption, the link url, the alt text, the image src, and whether to open in a new tab\n- loop_slides(boolean) When True, continuously loop through slides\n- num_seconds(number) Time in seconds to pause between slides\n- show_pagination(boolean) Provide buttons below slider to randomly navigate among slides\n- sizing(enum static|resize) Determines whether the slider changes sizes, based on the height of the slides\n- auto_advance(boolean) Automatically advance slides after the time set in num_seconds\n- transition(enum slide|) Sets the type of slide transition\n- caption_position(enum below|superimpose) Affects positioning of caption on or below the slide\n- display_mode(enum standard|thumbnail|lightbox) Determines which mode the slider will display\n- lightboxRows(number) Rows in lightbox mode", "prefix": "~gallery" }, "global_module": { "body": [ - "{% global_module 'my_global_module' %}" + "{% global_module %}" ], "description": "", "prefix": "~global_module" }, "global_widget": { "body": [ - "{% global_widget 'my_global_widget' \n\tglobal_widget_name='${1:global_widget_name}'%}" + "{% global_widget \"${1:name}\" label='${2:Label}' %}" ], "description": "A global widget is one which can be shared across templates\nParameters:\n- global_widget_name(String) Global module name", "prefix": "~global_widget" }, "google_search": { "body": [ - "{% google_search 'my_google_search' \n\tprefill_input_with_pathname='${1:prefill_input_with_pathname}', \n\tsearch_field_label='${2:search_field_label}', \n\tsearch_button_text='${3:search_button_text}'%}" + "{% google_search '${1:name}' \n\tprefill_input_with_pathname='${2:prefill_input_with_pathname}', \n\tsearch_field_label='${3:search_field_label}', \n\tsearch_button_text='${4:search_button_text}'%}" ], "description": "Allow visitors to search your site on Google\nParameters:\n- prefill_input_with_pathname(boolean) Uses the end part of the URL to fill the search query field\n- search_field_label(String) Populates the label text in the