File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -113,9 +113,12 @@ define([
113113 var hasCodeSpans = / ` / . test ( text ) ,
114114 de_tilde ;
115115 if ( hasCodeSpans ) {
116- text = text . replace ( / ~ / g , "~T" ) . replace ( / ( ^ | [ ^ \\ ] ) ( ` + ) ( [ ^ \n ] * ? [ ^ ` \n ] ) \2 (? ! ` ) / gm , function ( wholematch ) {
116+ var tilde = function ( wholematch ) {
117117 return wholematch . replace ( / \$ / g, "~D" ) ;
118- } ) ;
118+ }
119+ text = text . replace ( / ~ / g, "~T" )
120+ . replace ( / ( ^ | [ ^ \\ ] ) ( ` + ) ( [ ^ \n ] * ?[ ^ ` \n ] ) \2(? ! ` ) / gm, tilde )
121+ . replace ( / ^ \s { 0 , 3 } ( ` { 3 , } ) ( .| \n ) * ?\1/ gm, tilde ) ;
119122 de_tilde = function ( text ) {
120123 return text . replace ( / ~ ( [ T D ] ) / g, function ( wholematch , character ) {
121124 return { T : "~" , D : "$" } [ character ] ;
Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ casper.notebook_test(function () {
103103 result = '<pre><code class="cm-s-ipython language-aaaa">x = 1</code></pre>'
104104 md_render_test ( codeblock , result , 'Markdown code block unknown language' ) ;
105105
106+ codeblock = '```python\ns = "$"\nt = "$"\n```'
107+ result = '<pre><code class="cm-s-ipython language-python">' +
108+ '<span class="cm-variable">s</span> <span class="cm-operator">=</span> <span class="cm-string">"$"</span>\n' +
109+ '<span class="cm-variable">t</span> <span class="cm-operator">=</span> <span class="cm-string">"$"</span></code></pre>' ;
110+ md_render_test ( codeblock , result , 'Markdown code block python' ) ;
111+
106112 function mathjax_render_test ( input_string , result , message ) {
107113 casper . thenEvaluate ( function ( text ) {
108114 window . _test_result = null ;
You can’t perform that action at this time.
0 commit comments