Skip to content

Implement rendering of images in markdown views #1991

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

Merged
merged 1 commit into from
Jan 15, 2023

Conversation

MinusGix
Copy link
Member

@MinusGix MinusGix commented Jan 14, 2023

  • Added an entry to CHANGELOG.md if this change could be valuable to users

This PR implements rendering of images in markdown views (hover, completion documentation, signature, and plugin readmes).

  • The loading icon it shows is a bit weird, because typically you see them spinning
  • Sometimes the images don't load???
    • I had this most often with the plugin readme (I put an image in my Aleph theme plugin's readme for testing).
    • I note that I have the same issue with plugin icons sometimes not loading, despite that they should be in the local cache folder by now. I'd think this was some github throttling (are those icons even hosted on github pages?), but it also happened for a local image (if less often??). I'm very confused.
  • The positioning of images is off. This is mostly due to the code not paying attention to whether the user did a hard line break before the image or not. That'll have to be fixed for having links work in markdown views too.
  • This provides an ImageCache.
    • Does not currently load SVGs, so it doesn't swap out the volt icon loading code to use image cache. (Though that should be possible, but I'm somewhat confused as to the best way to decide the size of an svg if it isn't literally given to us?)
    • Does not actually clear the cache yet. It keeps track of the data, but when I had it immediately remove with zero references I got failures to load an image a lot more often?

@MinusGix MinusGix added the A-ui Area: UI rendering and interactions label Jan 14, 2023
@MinusGix MinusGix force-pushed the md-images branch 3 times, most recently from ceeb6e0 to 653639c Compare January 14, 2023 02:28
@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2023

Codecov Report

Merging #1991 (fe572aa) into master (8330152) will decrease coverage by 0.06%.
The diff coverage is 0.00%.

@@            Coverage Diff            @@
##           master   #1991      +/-   ##
=========================================
- Coverage    8.90%   8.84%   -0.07%     
=========================================
  Files         133     135       +2     
  Lines       57952   58364     +412     
=========================================
- Hits         5161    5160       -1     
- Misses      52791   53204     +413     
Impacted Files Coverage Δ
lapce-data/src/command.rs 0.00% <ø> (ø)
lapce-data/src/config.rs 0.00% <ø> (ø)
lapce-data/src/data.rs 0.00% <0.00%> (ø)
lapce-data/src/hover.rs 0.00% <0.00%> (ø)
lapce-data/src/images.rs 0.00% <0.00%> (ø)
lapce-data/src/lib.rs 100.00% <ø> (ø)
lapce-data/src/markdown/layout_content.rs 0.00% <0.00%> (ø)
lapce-data/src/markdown/mod.rs 0.00% <0.00%> (ø)
lapce-data/src/plugin.rs 0.00% <0.00%> (ø)
lapce-ui/src/completion.rs 0.00% <0.00%> (ø)
... and 14 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MinusGix MinusGix force-pushed the md-images branch 2 times, most recently from e3a4c3b to fe572aa Compare January 15, 2023 03:28
@dzhou121 dzhou121 merged commit 42fd6f0 into lapce:master Jan 15, 2023
@panekj panekj added this to the Next release milestone Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ui Area: UI rendering and interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants