library
library copied to clipboard
Links on images in Google Docs
Does Library recognize and render links that are applied to images within Google Docs? I did some testing and noticed links attached to images were stripped after being rendered in Library.
Is there a workaround for this or did I miss something in the docs? Just curious.
Hey @thomasoide, thanks for flagging this. I think this is a bug in the interaction between Library's formatting logic and exported HTML from the Google Drive API. We should investigate how the links are being removed and resolve that to fully support links around images.
In the meantime, Library does have a power user feature that could function as a workaround. It enables the injection of raw HTML from a Google Doc inside <%-
%>
brackets which would work around this for now, but it's not enabled by default and requires an environment variable to activate.
I did some digging in the Google Drive API and this appears to be a bug on their end. The HTML in the response from the API is missing links on images, though the problem does not seem to occur for other MIME types that support links.
I've gone ahead and filed a bug report with google here - give it a star if you can!
@leranjun gave thorough steps to reproduce in #287 (closed as dupe):
Context (Environment)
An installation of Library without too much customisation. (I know I'm being vague here, but I think the context should be irrelevant XD)
Expected Behavior
Clicking on an image with a link assigned should take me to the linked site.
Actual Behavior
It does not.
In Google Docs:
Rendered DOM in Library:
No
<a>
tags at all.To Reproduce
- Add an image to a Google Doc.
- Add a link to the image by selecting the image and going to
Insert -> Link
.- Click on the image in Google Docs. It should display a pop up to the web page as above.
- Click on the image in Library. Nothing happens.
Didn't notice there was already an issue! 😄
A temporary workaround I'm using is just wrapping the image in an <a>
tag manually, but that requires the inline code feature to be turned on.