flammy / imagebox

This dokuwiki plugin displays captions in a box drawn around an image.
https://www.dokuwiki.org/plugin:imagebox
GNU General Public License v2.0
5 stars 7 forks source link

Images and paragraphs #111

Closed pparik closed 1 year ago

pparik commented 5 years ago

Boxed images do not respect paragraphs (i.e. if there is an empty line in between) as normal images do.

Case 1

{{image1.jpg}}
{{image2.jpg}}

produces <p><img><img></p>.

Case 2

{{image1.jpg}}

{{image2.jpg}}

produces <p><img></p><p><img></p>.

Boxing the images using [] gets the same result in both cases (<div>s next to each other, <p>s are not used at all). Fixing this issue will at least allow tweaking everything else in userscript.js and userstyle.css.

P.S. It would be perfect if the boxed images behave EXACTLY like normal images (with respect to paragraphs, margins, etc.).

Anyways, thanks for your work!

RigacciOrg commented 2 years ago

Trying to find a workaround for this problem, I changed the getPType() function into the plugins/imagebox/syntax.php file:

function getPType(){ return 'normal'; }

Now I get the <p></p> tags as expected with normal images.

I did not experimented with image alignment (left, center, rights) and really I don't understand the implications of such a change.

flammy commented 1 year ago

It's not allowed to put block elements like divs or fig inside a p element.

The img is an inline element, which could be placed inside of an p element.

We have to use an block element here to store the caption.