Convert Markdown to HTML with Showdown
Markdown is a markup language designed to format plain text and maintain human readability. For publishing, Markdown content is usually converted to a more advanced language, such as HTML. SurveyJS supports Markdown via third-party Markdown-to-HTML JavaScript converters. This demo shows SurveyJS integration with the Showdown converter. Read more...
Markdown is a markup language designed to format plain text and maintain human readability. For publishing, Markdown content is usually converted to a more advanced language, such as HTML. SurveyJS supports Markdown via third-party Markdown-to-HTML JavaScript converters. This demo shows SurveyJS integration with the Showdown converter.
To enable Markdown support in your survey, implement a function that handles the onTextMarkdown
event. The function's second parameter, options
, has the text
property that contains a string value with Markdown content. Pass this value to the Showdown converter to get HTML markup. Note that the converter wraps the passed Markdown string into an unnecessary paragraph (<p>
tag). Remove this tag and assign the result to the options.html
property.
Now you can add formatting to your string values. Refer to the Markdown Cheat Sheet to get acquainted with Markdown syntax. This demo shows a Matrix question. Markdown is used to render statements in the rows in italic. You can combine Markdown syntax with raw HTML in string values. In this demo, <br>
tags are used to insert line breaks into column header texts.