rust-html2text icon indicating copy to clipboard operation
rust-html2text copied to clipboard

example improvements

Open jarjk opened this issue 1 year ago • 5 comments

  • fix(examples/html2term): more (vim-alike) keybinds
  • fix(examples/html2text): use yansi instead of termion for colouring
    • adds support for hyperlinks
    • more intuitive IMO
    • supports windows

jarjk avatar Nov 04 '24 13:11 jarjk

[!NOTE] one test doesn't pass, as I've removed the unicode character strikethrough thing

image

should I revert it and use the old method, or use the new one (yansi .strike()) which IMO looks better, but only applies in the html2text example, not elsewhere, and delete the test?

jarjk avatar Dec 02 '24 15:12 jarjk

I've got the following question: is there a fairly easy way of turning markdown-like decorations in the scope of examples/html2text? I find it quite annoying, that *bold text looks like this* and would prefer bold text to look like this without the *-s

jarjk avatar Dec 03 '24 14:12 jarjk

Hi. About the strikeout, I think it should at least be an option, since terminal escape sequences aren't always available.

I've got the following question: is there a fairly easy way of turning markdown-like decorations in the scope of examples/html2text? I find it quite annoying, that bold text looks like this and would prefer bold text to look like this without the *-s

There are a couple of options:

  1. Use --literal (under the hood uses TrivialDecorator)
  2. Use --colour (possibly with --css and the css feature enabled), which uses internally uses the "Rich" output which adds metadata annotations instead of textual decoration, and adds some terminal colouring.

jugglerchris avatar Dec 03 '24 20:12 jugglerchris

neither the --css --colour --trivial or any combination of these solve my "issue": I'd like to use this tool to render html into the terminal. Without paging, with styles, colours and hyperlinks.

html currenly rendered as preferred rendering
<strong>I'm bold</strong> *I'm bold* I'm bold

conclusion

I find the '*'-s annoying and would like to see eg bold text without them

like #91

jarjk avatar Jan 13 '25 15:01 jarjk

Hi, Thanks for the clear description which has finally got through my skull. :) Makes a lot of sense.

I think #195 achieves that - it adds a --no-decorate option to the html2text example which (with --colour) removes the '*' etc. (Headings and bullets etc. are still there) How does that look?

A higher-level option to avoid having to specify --colour --no-decorate would probably be a good idea if nothing else.

jugglerchris avatar Jan 19 '25 10:01 jugglerchris

anyways, I've found chawan, which is basically a TUI web browser, and so does an impressively good job at rendering html.

I'm closing this now out-of-date spaghetti PR ;)

jarjk avatar Sep 08 '25 20:09 jarjk