Open testmonger opened 6 years ago
care must be taken to sanitise the output.
I was able to successfully apply markdown -> html transformations, in collection and requests descriptions, by implementing a workaround with the help of Remarkable. Just take the default template used by newman and apply the following changes:
<head>
(provide different lib versions if necessary)<script src="https://cdn.jsdelivr.net/combine/npm/jquery@3.3.1,npm/bootstrap@3.3.7/dist/js/bootstrap.min.js,npm/remarkable@1.7.1/dist/remarkable.min.js"></script>
<body>
<script type="text/javascript">
const remarkable = new Remarkable();
const collectionDescription = document.querySelector("#collectionDescription");
if(collectionDescription) {
collectionDescription.innerHTML = renderHtmlFromMarkdown(collectionDescription.textContent);
}
const requestDescriptions = document.querySelectorAll("#requestDescription");
requestDescriptions.forEach(requestDescription => {
requestDescription.innerHTML = renderHtmlFromMarkdown(requestDescription.textContent);
});
function renderHtmlFromMarkdown(markdown) {
return remarkable.render(trim(markdown));
}
function trim(string) {
return string ? string.replace(/^ +| +$/gm, "") : string;
}
</script>
Don't forget to provide the new template through newman options, e.g.:
"reporter": {
"html": {
"export": "report.html",
"template": "new-template.hbs"
}
}
@kunagpal @shamasis @testmonger Can I work on this?
newman -v
): 3.8.3Steps to reproduce the problem:
Edit collection description to include markdown. Example: Functional Test Plan
Overview
Expected: html report displays markdown as html styles (like heading 1). Actual: report shows markdown syntax instead of rendering as html tag format. example: Description: Functional Test Plan ================================= Overview -------- executes a series of API level tests to verify the functional accuracy