thimc / lfimg

Image preview support for lf (list files) using Überzug
GNU General Public License v3.0
252 stars 45 forks source link

support for .md markdown files - now works after installing glow #47

Closed casperl closed 2 years ago

casperl commented 2 years ago

Firstly, I am over the moon with being able to preview images and other documents in lf, thank you for this.

Upate: I am closing this since I installed glow and markdown preview is now working satisfactorily. Furthermore I found that there is already support for glow in lfimg while I did not view the preview script before I posted an issue. If I have further problems, I will open another issue.

image

I edit files in markdown with the md command and while I installed all the add-on and optional add-on programs listed in your documentation no preview appears when I selected a file such as test.md in lf with lfimg installed and where I invoked lfrun.

There are a few possible ways of achieving the preview of markdown files:

UPDATE: I have just discovered GLOW which is terminal based markdown reader (https://github.com/charmbracelet/glow) This might just fit the bill. There is a good video tutorial on integrating glow into lf — https://www.youtube.com/watch?v=EDNpK3iH7A0

1) View it as plain text files which simply means adding the .md and .markdown extension to the mechanism used presently to preview text files. (I am perfectly content with this as a minimum option.) Extensions used for markdown to be displayed as text are: .md .markdown .mdown .mkd .rst .rmd 2) Using a utility program to present .md and .markdown extension as a syntax highlighted text file. mdless, mdlint are two such utilities. 3) Using a utility program to display markdown as a formatted html document. This is probably not possible to implement without invoking a minimalist web browser every time a markdown file is previewed. This would therefore not be a preferred option though I am going to experiment with adding a custom keystroke to my lfrc config to invoke something akin to either 1) bashblog to preview a markdown file in a browser or 2) by using the built-in preview functionality contained in any of the numerous markdown editors floating around.