I am using ShadowJs with Handlebars templating to process markdown that is being used in my record text field, but I have a persistent error that happens where the text is processed and converted to markdown with <pre><code></code></pre>
wrapping all of the text that was inputed in the field rather than just the text with the markdown-specific code wrapping. Is there a reason why this is happening? Maybe the result of my JS setup?
activity-feed.js
window.onload = function() {
var converter = new showdown.Converter();
var markdownInput = document.getElementById('discovery-text');
console.log('Pre conversion' + markdownInput.innerHTML);
var convertTextAreaToMarkdown = function(){
var markdownText = markdownInput.innerHTML;
var html = converter.makeHtml(markdownText);
console.log(html);
markdownInput.innerHTML = html;
console.log(markdownInput);
};
convertTextAreaToMarkdown();
};
Console.logs:
line 4:
Pre conversion
##h2
line 10:
<pre><code> ##h2
</code></pre>
line 14:
<div id="discovery-text"><pre><code> ##h2
</code></pre></div>
view file:
<div id="discovery-text">
{{{discovery.discovery}}}
</div>