nvim-devdocs icon indicating copy to clipboard operation
nvim-devdocs copied to clipboard

Consider using an already established HTML text renderer

Open horta opened this issue 1 year ago • 3 comments

The project https://github.com/toiletbril/dedoc uses rust library https://crates.io/crates/html2text which renders html very nicely in my terminal

Dedoc

vs

nvim-devdocs

Thank you for the plugin, btw!

horta avatar Jan 24 '24 23:01 horta

I have used fzf with html2text to create a prototype for terminal only:

image

Command to replicate it:

# html files for C language
cd ~/.dedoc/docsets/c
find * -type f | fzf --preview '~/bin/html2text --colour --width $FZF_PREVIEW_COLUMNS {}'

where html2text binary was compiled from https://github.com/jugglerchris/rust-html2text/blob/main/examples/html2text.rs

horta avatar Jan 25 '24 01:01 horta

Interesting, I think adding an option to save docs as HTML should be possible and the command system should work out of the box. There's one really tricky problem though, devdocs documentations are split into sections, one HTML file can contain multiple sections. The worst possible case is the Lua doc which is only one big HTML file. We'd still need to traverse all files using treesitter and split them when downloading, but that sounds interesting... I'll try to add this soon :)

luckasRanarison avatar Jan 25 '24 02:01 luckasRanarison

Another interesting alternative is pandoc. The vim plugin devdocs.vim has a lua pandoc writer that outputs vim help syntax.

pedrohgmacedo avatar Mar 10 '24 18:03 pedrohgmacedo