var json = { "elements": [ { "type": "radiogroup", "hasOther": true, "isRequired": true, "name": "favoritePet", "title": "What is your favorite pet ![A parrot](https://surveyjs.io/Content/Images/examples/markdown/image_16x16.svg =16x16) ?", "choices": [ { "value": "dog", "text": "Dog: ![A dog](https://surveyjs.io/Content/Images/examples/markdown/dog.svg =14x14)" }, { "value": "cat", "text": "Cat: ![A cat](https://surveyjs.io/Content/Images/examples/markdown/cat.svg =14x14)" }, { "value": "parrot", "text": "Parrot ![A parrot](https://surveyjs.io/Content/Images/examples/markdown/parrot.svg =14x14)" } ] } ], completedHtml: "Your favorite pet is <b>{favoritePet}</b>." }; Survey.StylesManager.applyTheme("defaultV2"); var survey = new Survey.Model(json); survey.onComplete.add(function(result) { document.querySelector('#result').innerHTML = "result: " + JSON.stringify(result.data); }); var converter = new showdown.Converter(); survey.onTextMarkdown.add(function(survey, options){ //convert the mardown text to html var str = converter.makeHtml(options.text); //remove root paragraphs <p></p> str = str.substring(3); str = str.substring(0, str.length - 4); //set html options.html = str; }); $("#surveyElement").Survey({ model: survey });
<div id="surveyElement"></div> <div id="result"></div>