Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
dee38e98
Commit
dee38e98
authored
Apr 14, 2016
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add parameter documentation for renderMathAndMarkdown()
parent
287cf3d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
render-markdown.js
h/static/scripts/render-markdown.js
+7
-2
No files found.
h/static/scripts/render-markdown.js
View file @
dee38e98
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment