luckasRanarison / nvim-devdocs

Neovim DevDocs integration
MIT License
265 stars 19 forks source link

Consider using an already established HTML text renderer #72

Open horta opened 7 months ago

horta commented 7 months ago

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 commented 7 months ago

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

luckasRanarison commented 7 months ago

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 :)

pedrohgmacedo commented 6 months ago

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