Skip to content
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

[Question] Image Support #49

Closed
AblatedSprocket opened this issue Apr 12, 2021 · 8 comments
Closed

[Question] Image Support #49

AblatedSprocket opened this issue Apr 12, 2021 · 8 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@AblatedSprocket
Copy link
Contributor

Is there support for parsing on Org link to an image file when exporting? For example, parsing the link as an tag (or something) in the HTML output?

@clarete
Copy link
Collaborator

clarete commented Apr 16, 2021

hi @AblatedSprocket thanks for taking the time to open this issue with your question.

Do you refer to inserting an Org-Mode link to an image file and get that link to be translated to an <img> tag? If so, you currently have to link it directly to the file with a regular org-mode link

[[/path/the/image/file.png]]

If you're looking into using weblorg's routing system, unfortunately, url_for currently only generates a tags. e.g.:

[[url_for:static,file=image.png][an image]]

I think it'd be great to find a way to tell url_for to generate an img tag instead of a regular link. Let me know if you have any suggestions. I'll see if I can come up with something too in the meantime 😄

@AblatedSprocket
Copy link
Contributor Author

AblatedSprocket commented Apr 17, 2021

There's another issue open for this, but I think my ideal use case would be using plain old org syntaxes and weblorg would override the exporter. That sounds hard though.

Using url_for would work ok for me as well and sounds easier, I'll look and see if I can think of something.

@AblatedSprocket
Copy link
Contributor Author

What if we just add another definition in org-link-set-parameters:

(org-link-set-parameters
     "img"
     :export (lambda(path desc _backend)
               (format "<img href=\"%s\" />" (weblorg--url-for path site)))

@clarete
Copy link
Collaborator

clarete commented Apr 21, 2021

Hi @AblatedSprocket 👋🏾 this looks pretty good to me. What do you think about calling it url_for_img?
you can register it in weblorg--route-install-template-filters 🙇🏾 do you think you'd be interested in trying to put another lil PR for this? 😄

@clarete clarete added the good first issue Good for newcomers label Apr 21, 2021
@AblatedSprocket
Copy link
Contributor Author

You know, I just might

@clarete clarete added the documentation Improvements or additions to documentation label Apr 30, 2021
@clarete
Copy link
Collaborator

clarete commented Apr 30, 2021

Just merged #53, thank you @AblatedSprocket for another contribution to weblorg 😄
thank you for taking the time 🙇🏾

@AblatedSprocket
Copy link
Contributor Author

Thanks for creating such a great library!

@clarete
Copy link
Collaborator

clarete commented Sep 4, 2021

added docs for this the commit 7ccfc44

@clarete clarete closed this as completed Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants