Reledia / glow.yazi

Glow preview plugin for yazi
MIT License
61 stars 2 forks source link

Previews no longer working with `glow` 2.0.0 #7

Closed xfzv closed 1 month ago

xfzv commented 2 months ago

glow 2.0.0 was released on 2024-08-23.

On my Gentoo install with glow 1.5.1, glow.yazi displays markdown previews just fine.

However, on my two Arch Linux installs with glow 2.0.0, all I'm getting is regular text.

Downgrading to 1.5.1 on Arch Linux solves the issue.


Edit: Also broken on my Gentoo install after updating glow to 2.0.0.

Reledia commented 2 months ago

By https://github.com/charmbracelet/glow/issues/440, you need to set the env variable CLICOLOR_FORCE to 1. It is a workaround, but there is no other mention of this since v2.0 that I can find.

xfzv commented 2 months ago

By https://github.com/charmbracelet/glow/issues/440, you need to set the env variable CLICOLOR_FORCE to 1.

Thanks, good catch.

Note that

% glow file.md

works just fine in the terminal with either 1.5.1 or 2.0.0, without any additional option. It's only broken with glow.yazi and glow 2.0.0.

Can confirm that export CLICOLOR_FORCE=1 restores the colors in the yazi previewer. Maybe this should be added by default?

folliehiyuki commented 1 month ago

Setting CLICOLOR_FORCE=1 will make glow use ANSI 4-bit color profile, if terminal is not detected. This is not the most beautiful output mode for people using terminal with TrueColor support. https://github.com/charmbracelet/glow/pull/626 is the PR introducing the preview problem.

wiraki commented 1 month ago

There is this pull request: https://github.com/Reledia/glow.yazi/pull/8

You can check the change it makes in init.lua in the commits and manually make the same change yourself in ~/.config/yazi/plugins/glow.yazi/init.lua

Reledia commented 1 month ago

Merged it