I want to use Markdown to preview to the user how a form field on a twig file will be styled using javascript.
Basically what I'm trying to do, is :
// This function is used to show the Description Preview
$( "#server_new_profile_description" ).on('input propertychange', function() {
// This should make the $(this).val() formated in markdown
var descrString = $(this).val();
$("#descriptionPrev div").html("{{- "+descrString+"|markdown|raw -}}");
});
What I get:
If the input is *ABC*
the output will be: {{*ABC*|markdown|raw}}.
instead of ABC
Can anyone get me through this?