mirror of https://github.com/zulip/zulip.git
Tolerate spaces after language in markdown fences.
See #2357. We now support `~~~ .py ` with that trailing space. Note that the test coverage is Python-side only due to bugdown_matches_marked being set to false, since we don't yet support language syntax on the client side. (imported from commit ccd5fcb0eee01478d349161400103480678d7486)
This commit is contained in:
parent
91fb286b0d
commit
8f37c3f5fd
|
@ -15,6 +15,7 @@ var fencestr = "^(~{3,}|`{3,})" + // Opening Fence
|
|||
"\\{?\\.?" +
|
||||
"([a-zA-Z0-9_+-]*)" + // Language
|
||||
"\\}?" +
|
||||
"[ ]*" + // Spaces
|
||||
")$";
|
||||
var fence_re = new RegExp(fencestr);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"regular_tests": [
|
||||
{
|
||||
"name": "codeblock_hilite",
|
||||
"input": "Hamlet said:\n~~~~.python\ndef speak(self):\n x = 1\n~~~~",
|
||||
"input": "Hamlet said:\n~~~~.python \ndef speak(self):\n x = 1\n~~~~",
|
||||
"expected_output": "<p>Hamlet said:</p>\n<div class=\"codehilite\"><pre><span class=\"k\">def</span> <span class=\"nf\">speak</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n <span class=\"n\">x</span> <span class=\"o\">=</span> <span class=\"mi\">1</span>\n</pre></div>",
|
||||
"bugdown_matches_marked": false
|
||||
},
|
||||
|
@ -574,4 +574,4 @@
|
|||
"http://generate.quora.net/render?width=700&from=-4hours&until=now&height=400&bgcolor=black&lineMode=connected&title=arb%20hint%20status&target=alias(ans.hintland.hand.arb.enhint_rate%2C%22enhint%20rate%22)&target=alias(ans.hintland.hand.arb.unhint_rate%2C%22unhint%20rate%22)&target=alias(ans.hintland.hand.arb.size%2C%22hint%20size%22)&target=alias(scale(ans.vagabond.dingarb_cube_count%2C10000)%2C%22cube%20count%20x%2010K%22)&target=alias(scale(hnumbers.time.ding.gegevens.query.count%2C10)%2C%22ding%20gegevens%20query%20count%20x%2010%22)&fgcolor=white&uniq=0.44046106841415167"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ FENCE_RE = re.compile(r"""
|
|||
) # "py" or "javascript"
|
||||
\}?
|
||||
) # language, like ".py" or "{javascript}"
|
||||
[ ]* # spaces
|
||||
$
|
||||
""", re.VERBOSE)
|
||||
|
||||
|
|
Loading…
Reference in New Issue