Skip to content

Commit

Permalink
handle the </script> end bug inside code markdown
Browse files Browse the repository at this point in the history
by changing the tag before html is parsed and restoring it before markdown parsing
  • Loading branch information
bfritscher committed Apr 12, 2015
1 parent 8858ee7 commit 9645a76
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugin/markdown/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@

// strip leading whitespace so it isn't evaluated as code
var text = ( template || section ).textContent;

// restore script end tag
text = text.replace(/__SCRIPT_END__/g, '</script>');
var leadingWs = text.match( /^\n?(\s*)/ )[1].length,
leadingTabs = text.match( /^\n?(\t*)/ )[1].length;

Expand Down Expand Up @@ -114,7 +115,8 @@
if( notesMatch.length === 2 ) {
content = notesMatch[0] + '<aside class="notes" data-markdown>' + notesMatch[1].trim() + '</aside>';
}

//handle script end tag bug
content = content.replace(/<\/script>/g, '__SCRIPT_END__');
return '<script type="text/template">' + content + '</script>';

}
Expand Down

0 comments on commit 9645a76

Please sign in to comment.