Commit dee38e98 authored by Robert Knight's avatar Robert Knight

Add parameter documentation for renderMathAndMarkdown()

parent 287cf3d9
...@@ -18,7 +18,7 @@ var converter; ...@@ -18,7 +18,7 @@ var converter;
* This function does *not* sanitize the HTML in any way, that is the caller's * This function does *not* sanitize the HTML in any way, that is the caller's
* responsibility. * responsibility.
*/ */
function renderMarkdown(html) { function renderMarkdown(markdown) {
if (!converter) { if (!converter) {
// see https://github.com/showdownjs/showdown#valid-options // see https://github.com/showdownjs/showdown#valid-options
converter = new showdown.Converter({ converter = new showdown.Converter({
...@@ -31,7 +31,7 @@ function renderMarkdown(html) { ...@@ -31,7 +31,7 @@ function renderMarkdown(html) {
literalMidWordUnderscores: true, literalMidWordUnderscores: true,
}); });
} }
return converter.makeHtml(html); return converter.makeHtml(markdown);
} }
/** /**
...@@ -59,6 +59,11 @@ function renderInlineMath(text) { ...@@ -59,6 +59,11 @@ function renderInlineMath(text) {
* *
* LaTeX blocks are delimited by '$$' (for blocks) or '\(' and '\)' * LaTeX blocks are delimited by '$$' (for blocks) or '\(' and '\)'
* (for inline math). * (for inline math).
*
* @param {string} text - The markdown and LaTeX to render
* @param {(string) => string} $sanitize - A function that sanitizes HTML to
* remove any potentially unsafe tokens (eg. <script> tags).
* @return {string} The sanitized HTML
*/ */
function renderMathAndMarkdown(text, $sanitize) { function renderMathAndMarkdown(text, $sanitize) {
var html = text.split('$$').map(function (part, index) { var html = text.split('$$').map(function (part, index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment