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

Adding image support #971

Closed
1 task done
3rd opened this issue Jul 2, 2023 · 12 comments
Closed
1 task done

Adding image support #971

3rd opened this issue Jul 2, 2023 · 12 comments
Labels
feature Issues related to feature proposals. Please attach a module.

Comments

@3rd
Copy link

3rd commented Jul 2, 2023

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

Hey, I'm working on a hacky way to add (some) image support to Neovim, and I'm trying to write integration for Neorg. Looking at the spec and #14, I assume a simple query for a macro matching .image https://url would be enough, but I've hit the following problem.

URLs seem to be broken apart when inside a (tag_parameters (param)) and there's also an error in the tree:
image

What works:

  • .image test.png

What doesn't work:

  • .image https://example.com/test.png
  • .image /tmp/test.png
  • .image ./test.png

Thank you!

Help

Yes

Implementation help

I need help with figuring out how to retrieve the images and their target position from a Norg document.

@3rd 3rd added the feature Issues related to feature proposals. Please attach a module. label Jul 2, 2023
@vhyrro
Copy link
Member

vhyrro commented Jul 2, 2023

Hey! This parser bug will probably stay for a week or two more because there are so many priorities clashing in the project (plus I'm away on holiday right now :p), so I think it's best if you focus on other integrations and I'll let you know when this is fixed. Thanks for considering adding neorg support in the first place!

Btw, a while back I made a fork of hologram attempting to add more features. The most notable is its support for essentially every image format, thanks to the use of the magick luarock which allows for translating other formats to png via imagemagick. Yes, that does require luarocks, but I thought you might be interested since you're working on a hologram rewrite and might want vast image support :)
The code for that is found here with info in the README, plus the important code snippet here. Maybe my code can be of use after all haha.

@3rd
Copy link
Author

3rd commented Jul 2, 2023

Wow, this is great, thank you so much!
Didn't even think about this option, it would save so much pain for cropping as well!

@3rd
Copy link
Author

3rd commented Jul 3, 2023

@vhyrro Just wanna say thanks again, added magick as well and it's great (although I had to monkey patch the rock).
This means all image formats and ueberzugpp are supported now.
I'll grab the Neorg query from your fork and get it up & running with test.png, that seems to work fine.
Did some optimizations to the kitty rendering and it's very fast even inside tmux now: https://gist.ro/magick.mp4

@vhyrro
Copy link
Member

vhyrro commented Jul 4, 2023

Super glad to hear!

@3rd
Copy link
Author

3rd commented Jul 4, 2023

Done, thank you so much for all your contributions!

norg.mp4

@3rd 3rd closed this as completed Jul 4, 2023
@vhyrro
Copy link
Member

vhyrro commented Jul 5, 2023

Sick!! Good stuff :D
I'll get to fixing that parser whenever I can

@jackywu
Copy link

jackywu commented Aug 16, 2023

this feature seems awesome, and how is the things going ? can we display the image from a url in norg file in nvim ?

@debugtheworldbot
Copy link

Any updates for showing url image?

@3rd
Copy link
Author

3rd commented Oct 2, 2023

Did a change now to consider whatever is on the same line after .image the url, hope it's good enough for now.

image-neorg-remote.mp4

@vhyrro
Copy link
Member

vhyrro commented Oct 2, 2023

The temporary fix is a godsend. Thanks a lot!! I'll let you know when the issue is actually fixed, lots of things to do in Neorg so I haven't had time to implement the V3 parser yet :)

@mikesmithgh
Copy link

image-nvim.mp4

This is so effing cool! 🙂

@jackywu
Copy link

jackywu commented Aug 11, 2024

image-nvim.mp4
This is so effing cool! 🙂

cool, so is the latest version support it very well in default (without any configuration)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issues related to feature proposals. Please attach a module.
Projects
None yet
Development

No branches or pull requests

5 participants