Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/static/riot/competitions/detail/_tabs.tag
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,14 @@
// Need to run update() to build tags to render html in
self.update()
_.forEach(self.competition.pages, (page, index) => {
$(`#page_${index}`)[0].innerHTML = render_markdown(page.content)

if (self.isHTML(page.content)){
$(`#page_${index}`)[0].innerHTML = sanitize_HTML(page.content)
}else{
$(`#page_${index}`)[0].innerHTML = render_markdown(page.content)
}


})
_.forEach(self.competition.phases, (phase, index) => {
$(`#phase_${index}`)[0].innerHTML = render_markdown(phase.description)
Expand Down Expand Up @@ -359,6 +366,12 @@
CODALAB.events.trigger('phase_selected', data)
}
}
// To check if page content has HTML
// Return true if content is html
// Return false if content is not html i.e. MarkDown
self.isHTML = function (page_content) {
return /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(page_content);
}

self.update()

Expand Down