-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transfer paragraph attributes to image when used as a block #8362
Comments
@HenrySkup thanks for your input.
|
I was thinking about something like:
but I now realize that this would prob be just as difficult and quite a departure from markdown syntax. However on the forum @jmooring made an excellent comment. An i realized that I too had hacked together a render hook for this... though haven't been using it... If I remember correctly, there were some issues creating a properly formatted HTML string. |
Just found this in the common mark spec, which is kind of what I meant... i think. |
This both: * Removes any surrounding <p> nodes * And transfers any attributes from the surrounding <p> down to the image node Closes gohugoio#8362 Fixes gohugoio#10492
This both: * Removes any surrounding paragraph nodes * And transfers any attributes from the surrounding paragraph down to the image node Closes gohugoio#8362 Fixes gohugoio#10492
This both: * Removes any surrounding paragraph nodes * And transfers any attributes from the surrounding paragraph down to the image node Closes gohugoio#8362 Fixes gohugoio#10492
* Removes any surrounding paragraph nodes * And transfers any attributes from the surrounding paragraph down to the image node * Adds a new IsBlock field to the link context passed to the render hooks, only set for images. IsBlock is set to true if the image's parent node has only one child. Closes gohugoio#8362 Fixes gohugoio#10492 Fixes gohugoio#10494
* Removes any surrounding paragraph nodes * And transfers any attributes from the surrounding paragraph down to the image node * Adds a new IsBlock field to the link context passed to the render hooks, only set for images. IsBlock is set to true if `wrapStandAloneImageWithinParagraph = false` and the image's parent node has only one child. Closes gohugoio#8362 Fixes gohugoio#10492 Fixes gohugoio#10494
* Removes any surrounding paragraph nodes * And transfers any attributes from the surrounding paragraph down to the image node * Adds IsBlock and Ordinal (zero based) field to the image context passed to the image render hooks IsBlock is set to true if `wrapStandAloneImageWithinParagraph = false` and the image's parent node has only one child. Closes gohugoio#8362 Fixes gohugoio#10492 Fixes gohugoio#10494 Fixes gohugoio#10501
* Removes any surrounding paragraph nodes * And transfers any attributes from the surrounding paragraph down to the image node * Adds IsBlock and Ordinal (zero based) field to the image context passed to the image render hooks IsBlock is set to true if `wrapStandAloneImageWithinParagraph = false` and the image's parent node has only one child. Closes #8362 Fixes #10492 Fixes #10494 Fixes #10501
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
See discussion in https://discourse.gohugo.io/t/is-it-possible-to-use-attribute-lists-with-render-hooks/31374/6?u=bep
So, images are by definition an inline element, but it most typically is used in block contexts, e.g.:
I have not tested the above, but I suspect that the attributes list
{ .myclass }
will be applied to the surround paragraph block.Since the parsing complexity prevents us from adding attributes to links/images, an option may be to transfer the surrounding block's attributes to the image.
We can certainly have an option to toggle this off, but I suspect that most people would say that the attribute above belongs to the image and not the paragraph.
Thoughts?
The text was updated successfully, but these errors were encountered: