I am trying to whitelist some HTML tags and am using launcher's templates for this. The JS files gets modified properly, but I cannot actually use the tags: the lines with them are stripped of any content and are returned as <br />
. Is there anything else I have to modify?
I am sharing the complete file here instead of a minimal example, because it might be of interest to other users:
# templates/assets-whitelist-table.template.yml
hooks:
before_bundle_exec:
- exec:
cmd: echo ":whitelisted:" >> "/var/www/discourse/app/assets/javascripts/discourse/lib/markdown.js"
- replace:
filename: "/var/www/discourse/app/assets/javascripts/discourse/lib/markdown.js"
from: /^:whitelisted:.*$/
to: |
Discourse.Markdown.whiteListTag('table', 'class', '*');
Discourse.Markdown.whiteListTag('table', 'id', '*');
Discourse.Markdown.whiteListTag('table', 'border', '*');
Discourse.Markdown.whiteListTag('caption', 'class', '*');
Discourse.Markdown.whiteListTag('thead', 'class', '*');
Discourse.Markdown.whiteListTag('tbody', 'class', '*');
Discourse.Markdown.whiteListTag('tfoot', 'class', '*');
Discourse.Markdown.whiteListTag('tr', 'class', '*');
Discourse.Markdown.whiteListTag('tr', 'align', '*');
Discourse.Markdown.whiteListTag('tr', 'valign', '*');
Discourse.Markdown.whiteListTag('tr', 'bgcolor', '*');
Discourse.Markdown.whiteListTag('colgroup', 'class', '*');
Discourse.Markdown.whiteListTag('col', 'class', '*');
Discourse.Markdown.whiteListTag('col', 'nowrap', '*');
Discourse.Markdown.whiteListTag('col', 'align', '*');
Discourse.Markdown.whiteListTag('col', 'char', '*');
Discourse.Markdown.whiteListTag('col', 'valign', '*');
Discourse.Markdown.whiteListTag('col', 'height', '*');
Discourse.Markdown.whiteListTag('col', 'width', '*');
Discourse.Markdown.whiteListTag('col', 'bgcolor', '*');
Discourse.Markdown.whiteListTag('td', 'class', '*');
Discourse.Markdown.whiteListTag('td', 'nowrap', '*');
Discourse.Markdown.whiteListTag('td', 'align', '*');
Discourse.Markdown.whiteListTag('td', 'valign', '*');
Discourse.Markdown.whiteListTag('td', 'height', '*');
Discourse.Markdown.whiteListTag('td', 'width', '*');
Discourse.Markdown.whiteListTag('td', 'bgcolor', '*');
Discourse.Markdown.whiteListTag('th', 'class', '*');
Discourse.Markdown.whiteListTag('th', 'nowrap', '*');
Discourse.Markdown.whiteListTag('th', 'align', '*');
Discourse.Markdown.whiteListTag('th', 'valign', '*');
Discourse.Markdown.whiteListTag('th', 'height', '*');
Discourse.Markdown.whiteListTag('th', 'width', '*');
Discourse.Markdown.whiteListTag('th', 'bgcolor', '*');
This is what I expect to be passed through unmodified:
<table>
<tr><th>name</th><th>age</th></tr>
<tr><td>someone</td><td>100</td></tr>
</table>