Allow whitespace around % scaler in markdown image syntax (#5000)
This commit is contained in:
parent
febd7621ea
commit
27539e15e1
|
@ -104,7 +104,7 @@ function setupHoister(md) {
|
|||
md.renderer.rules.html_raw = renderHoisted;
|
||||
}
|
||||
|
||||
const IMG_SIZE_REGEX = /^([1-9]+[0-9]*)x([1-9]+[0-9]*)(,([1-9][0-9]?)%)?$/;
|
||||
const IMG_SIZE_REGEX = /^([1-9]+[0-9]*)x([1-9]+[0-9]*)(\s*,\s*([1-9][0-9]?)%)?$/;
|
||||
function renderImage(tokens, idx, options, env, slf) {
|
||||
var token = tokens[idx];
|
||||
|
||||
|
|
|
@ -970,6 +970,21 @@ HTML
|
|||
|
||||
expect(cooked).to eq(html.strip)
|
||||
end
|
||||
|
||||
it "allows whitespace before the percent scaler" do
|
||||
cooked = PrettyText.cook <<~MD
|
||||
![|220x100, 50%](http://png.com/my.png)
|
||||
![|220x100 , 50%](http://png.com/my.png)
|
||||
![|220x100 ,50%](http://png.com/my.png)
|
||||
MD
|
||||
|
||||
html = <<~HTML
|
||||
<p><img src="http://png.com/my.png" alt width="110" height="50">
|
||||
<img src="http://png.com/my.png" alt width="110" height="50">
|
||||
<img src="http://png.com/my.png" alt width="110" height="50"></p>
|
||||
HTML
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "inline onebox" do
|
||||
|
|
Loading…
Reference in New Issue