redcloth icon indicating copy to clipboard operation
redcloth copied to clipboard

Issues with image alignment formatters

Open sronsiek opened this issue 1 year ago • 0 comments

According to the Textile images spec, images can be right or left aligned, or centred:

!>/carver.png!
!</carver.png!
!=/carver.png!

Trying this, using RedCloth 4.3.2:

irb(main):066:0> RedCloth.new( '!>/carver.png!' ).to_html
=> "<p style=\"float:right;\"><img src=\"/carver.png\" alt=\"\" /></p>"

irb(main):067:0> RedCloth.new( '!</carver.png!' ).to_html
=> "<p style=\"float:left;\"><img src=\"/carver.png\" alt=\"\" /></p>"

irb(main):068:0> RedCloth.new( '!=/carver.png!' ).to_html
=> "<p><img src=\"/carver.png\" alt=\"\" /></p>"
  1. RedCloth attempts the right & left alignment, but seems to ignore the centring alignment.
  2. If the input text is preceded by anything, the right & left alignments are ignored:
irb(main):069:0> RedCloth.new( 'Hello!>/carver.png!' ).to_html
=> "<p>Hello<img src=\"/carver.png\" alt=\"\" /></p>"
irb(main):070:0> RedCloth.new( 'Hello\n\n!>/carver.png!' ).to_html
=> "<p>Hello\\n\\n<img src=\"/carver.png\" alt=\"\" /></p>"

sronsiek avatar Mar 08 '23 00:03 sronsiek