mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 13:07:54 +08:00
FEATURE: support image dimensions via Markdown image
This commit is contained in:
@ -890,5 +890,29 @@ HTML
|
||||
expect(PrettyText.cook("<script>alert(42)</script>")).to eq ""
|
||||
end
|
||||
|
||||
# custom rule used to specify image dimensions via alt tags
|
||||
describe "image dimensions" do
|
||||
it "allows title plus dimensions" do
|
||||
cooked = PrettyText.cook <<~MD
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
MD
|
||||
|
||||
html = <<~HTML
|
||||
<p><img src="http://png.com/my.png" alt="title with | title" width="220" height="100"><br>
|
||||
<img src="http://png.com/my.png" alt><br>
|
||||
<img src="http://png.com/my.png" alt width="220" height="100"><br>
|
||||
<img src="http://png.com/my.png" alt="stuff"><br>
|
||||
<img src="http://png.com/my.png" alt width="110" height="50"></p>
|
||||
HTML
|
||||
puts cooked
|
||||
|
||||
expect(cooked).to eq(html.strip)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user