kaushalmodi / ox-hugo

A carefully crafted Org exporter back-end for Hugo
https://ox-hugo.scripter.co
GNU General Public License v3.0
867 stars 130 forks source link

'#+attr_html' will be render as text still #669

Closed barddust closed 1 year ago

barddust commented 1 year ago

Hi, I met troubles when using #+attr_html to resize images.

Here is my org file snippet: image

After rendering (C-c C-e H h), i got this in md: image

The most interesting thing is, that image shrinks indeed, but #+attr_html width:50% is rendered into html too. image

I could not figure out what'd happened. Thanks if anyone helps! :)

kaushalmodi commented 1 year ago

There's a typo in the syntax. It should be:

#+attr_html: :width 50%

Example from ox-hugo test suite:

image

You can find more examples in the Org mode manual: https://orgmode.org/manual/Images-in-HTML-export.html

barddust commented 1 year ago

Oh, how careless i was!

And I found another annoying thing.

#+attr_html: :width 50% works, but it just adds a class attribute to that element. Actually, the width of the image is controlled by css style, i.e., the width in css style will override the width in class attribute.

I've also tried #+attr_html: :style width:50%;, which didn't work at all, it just produced a image without any changes.

Any suggestions?

kaushalmodi commented 1 year ago

@fingerknight

Hello, I am unable to reproduce the issue you are seeing. It will be helpful if you can post a minimal Org file that I can export myself to see the issue.

I have few tests of #+attr_html and :width in the ox-hugo test suite, and when I changed one of the test to use % for width, it exported as expected:

image


I won't be able to respond for the next 3 weeks as I will be on vacation.

barddust commented 1 year ago

Sorry about confusing, I've found what my problem really is:

it works i mean #+attr_html, my problem is something in html and css. I am look for other ways.

Thanks for your time. Have fun in your vacation! :)