Commit graph

44 commits

Author SHA1 Message Date
Folke Lemaitre
4bb1ce16ed
fix(image): guard against invalid buffers. Closes #2383 2025-10-29 17:34:00 +01:00
Daniel Wennberg
90227af497
fix(image): skip \usepackage in comments and body (#2325)
## Description

Here are some small and hopefully uncontroversial tweaks to package
extraction from LaTeX preambles:

* Don't consider anything in comments
* Make sure that the extracted names are actually the arguments of
`\usepackage` and not some other macro on the same line
* Stop looking for packages at `\begin{document}`, where the preamble
ends and the body of the document begins (you can't load packages after
this, so any `\usepackage` beyond this point is content, not code. Also
saves a huge amount of work in large documents.)

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-10-23 11:14:32 +02:00
Folke Lemaitre
43261baf87
fix(image): detect kitty image protocol through terminal capability request. Closes #1695 2025-10-22 16:56:26 +02:00
Folke Lemaitre
92a08cece7
fix(image): work-around for sha256 not allowed to be a Blob 2025-10-21 23:39:36 +02:00
Folke Lemaitre
2c56e10b1d
feat(image): added support for base64 encoded images in url. Closes #2304 2025-10-21 22:59:36 +02:00
Jay Z
ef59af0ffc
fix(image): hover close in insert mode (#2215)
## Description

I'm not 100% sure if this is a bug or if it was intentional, but the
`return` seems to have been lost from a previous refactor
e35d6cd4 (diff-ff9a4f8a621887c466394f755193cc78a5e69e0e2e86f4e668662e1434d3611eL878).

When an image displays using float or hover, the image can block the
text even in insert mode. This makes editing really hard. Adding the
`return` can close the hover in insert mode.

## Related Issue(s)

I couldn't find an issue created for this, but there is a discussion
about it https://github.com/folke/snacks.nvim/discussions/1777.

## Screenshots

Before the fix, the image shows in insert mode.
<img width="704" height="710" alt="image"
src="https://github.com/user-attachments/assets/224883d1-edbc-4f7a-8c1b-91ef00dbe21e"
/>

After the fix, the image stops showing in insert mode.
<img width="389" height="127" alt="image"
src="https://github.com/user-attachments/assets/d704d4f8-9259-4e5e-b7a9-954ea6e2a788"
/>
2025-10-19 12:04:44 +02:00
phanium
758e64c18f
fix(image): set winblend=0 for floatwin when use unicode placeholders (#1615)
When `winblend > 1`
(8de1dc6923/src/nvim/highlight.c (L751)),
hover image is not shown (in kitty).

Reproduce: `nvim +'set winblend=10' docs/image.md +2`

I have a `vim.o.winblend = 20` in global config before floatwin created.
That's why I notice it.

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-10-19 10:14:25 +02:00
Folke Lemaitre
e55ae37beb
perf(image): async treesitter parsing for images 2025-03-01 17:33:53 +01:00
Folke Lemaitre
6ea4fa72dc
feat(image): proper inline rendering of math expressions. Closes #1318. Closes #1454 2025-03-01 08:01:11 +01:00
Folke Lemaitre
842605f072
fix(compat): properly detect async treesitter parsing 2025-02-24 10:28:22 +01:00
Folke Lemaitre
e039139291
feat(image): configurable templates for math expressions. Closes #1338 2025-02-20 17:11:12 +01:00
Folke Lemaitre
1543a063fb
feat(image): allow disabling math rendering. Closes #1247 2025-02-20 11:56:56 +01:00
Folke Lemaitre
29c777a0a0
feat(image.doc): check for image.ignore in ts meta. See #1276 2025-02-20 11:14:24 +01:00
Folke Lemaitre
bc902f7032
feat(compat): added svim, a compatibility layer for Neovim. Closes #1321 2025-02-20 06:59:44 +01:00
Stefan Boca
4f8b9ebf71
fix(image.doc): crop inline typst equations properly (#1320)
Some checks failed
CI / ci (push) Failing after 0s
## Description

Tall inline typst equations were previously cropped too much vertically.
The change to the template now resize text frames to the bounding box of
their glyphs. See
https://typst.app/docs/reference/text/text/#parameters-top-edge for more
details.

## Related Issue(s)

<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots
Before:

![image](https://github.com/user-attachments/assets/15ea02e2-7d10-43bb-8d4f-fc51013c8a20)
After:

![image](https://github.com/user-attachments/assets/70de42d9-4b29-4333-a908-6be4729baa8a)
2025-02-19 23:41:29 +01:00
Folke Lemaitre
31e21ccef8
fix(image): move assertion for src/content. See #1276 2025-02-19 23:40:18 +01:00
Folke Lemaitre
bde3adddc7
feat(image.doc): allow configuring the header for latex / typst inline in the document. Closes #1303 2025-02-19 23:06:51 +01:00
Folke Lemaitre
bf01460e6d
feat(image): use search dirs to resolve file from both cwd and dirname of file. Closes #1305 2025-02-19 18:43:37 +01:00
Folke Lemaitre
684666f643
feat(image): conceal option for inline rendering (disabled by default) 2025-02-19 15:41:16 +01:00
Folke Lemaitre
65f89e2d6f
feat(image.doc): allow setting image.src with #set!. Closes #1276 2025-02-19 15:17:33 +01:00
Folke Lemaitre
b052eb9372
feat(image): allow customizing font size for math expressions 2025-02-19 13:15:42 +01:00
Folke Lemaitre
e27ba726b1
feat(image): make math packages configurable. Closes #1295 2025-02-19 06:48:02 +01:00
Folke Lemaitre
e2258236a2
feat(image): added math rendering for typst. Closes #1260 2025-02-19 00:11:27 +01:00
Folke Lemaitre
76f5ee4a1b
fix(image.doc): fixed at_cursor. Closes #1258
Some checks failed
CI / ci (push) Failing after 0s
2025-02-18 23:36:07 +01:00
Folke Lemaitre
2ee64887c2
fix(image.latex): include doc packages for math rendering. Closes #1262 2025-02-18 23:24:16 +01:00
Folke Lemaitre
5c0607e31a
fix(image): better image position caluclation. Closes #1268 2025-02-18 22:02:59 +01:00
Folke Lemaitre
004050c435
feat(image): images are now properly scaled based on device DPI and image DPI. Closing #1257 2025-02-18 16:31:37 +01:00
Folke Lemaitre
9e422e1287
fix(image.latex): inline math formulas. Closes #1246 2025-02-18 00:25:08 +01:00
Folke Lemaitre
1f9ba12755
fix(image.hover): close when needed. Closes #1229 2025-02-17 14:37:27 +01:00
Folke Lemaitre
ad0b88dc08
feat(image): added opts.img_dirs to configure the search path for resolving images. Closes #1222 2025-02-17 13:12:44 +01:00
Folke Lemaitre
1bca71a133
feat(image): added support for math expressions in latex and markdown doc + images in latex. Closes #1223 2025-02-17 12:50:35 +01:00
Folke Lemaitre
a596f8a9ea
feat(image): added support for a bunch of aditional languages 2025-02-16 14:16:15 +01:00
Folke Lemaitre
d18680c931
docs: docgen 2025-02-16 09:23:16 +01:00
Folke Lemaitre
ab0ba5cb22
feat(image): added support for tsx, jsx, vue and angular 2025-02-16 09:21:09 +01:00
Folke Lemaitre
d41704f3da
feat(image): url_decode strings 2025-02-16 09:09:23 +01:00
Folke Lemaitre
14a1f32eaf
feat(image): added support for angle bracket urls. Closes #1209 2025-02-16 08:55:53 +01:00
Folke Lemaitre
6348ccf120
feat(image): added Snacks.image.doc.at_cursor(). See #1108 2025-02-16 08:50:52 +01:00
Folke Lemaitre
3fda27200d
feat(image): added support for wikilink style images. Closes #1210 2025-02-16 08:45:29 +01:00
Folke Lemaitre
86e3ddf2e4
fix(image): handle inline images at the same TS node, but that changed url. See #1203 2025-02-15 22:50:17 +01:00
Folke Lemaitre
942cb9291e
feat(image): make manual hover work correctly 2025-02-15 22:09:54 +01:00
Folke Lemaitre
668cbbba47
feat(image): try resolving paths relative to the document and to the cwd. See #1203 2025-02-15 22:02:06 +01:00
Folke Lemaitre
59bbe8d90e
feat(image): added support for .image tags in neorg 2025-02-15 15:20:10 +01:00
Folke Lemaitre
c067ffe86c
fix(image): support Neovim < 0.10 2025-02-15 14:48:25 +01:00
Folke Lemaitre
e35d6cd4ba
feat(image): refactor + css/html + beter image fitting 2025-02-15 14:28:49 +01:00