shtmlview

shtmlview::shtmlview

DDG 2018-11-09: A snidget widget based on Stephen Uhler's and Clif Flynt's HTML display and Robert Heller's htmlhelp tool. The shtmlview::shtmlview widget can render a reasonable subset of HTML and since version 1.0, via tcllib Markdown library, of Markdown. It is useful where the developer has control over the content to be rendered. It is not a full fledged web browser and should be used only for local HTML and Markdown files.

DDG 2020-01-27: Version 0.9.1, just bug fixes and small extensions:

  • fixed typo in package provide
  • remove style section in body
  • mirror project on chiselapp
  • extension: --version option and standalone execution as html-browser: tclsh shtmlview.tcl filename.html

DDG 2022-03-10: Version 0.9.3:

  • support for mouse-wheel
  • bug fixes for text copy
  • bug fix for http(s) links and anchor links
  • thanks to aplsimple for report as suggestions

DDG 2022-03-23: Version 1.0.0

  • support for Markdown files via tcllibs Markdown library
  • support for HTML 3.2 tags sub, sup, div, small, big
  • support for base64 encoded images in HTML code (png, gif, jpeg, svg)
  • support for jpeg images if img::jpeg is available
  • support for svg images using https://github.com/mittelmark/svgconvert
  • anchor links now as well in history
  • toolbar bugfix
  • file normalize used to avoid problems with directory changes in documentation
  • multi-file mode to browse fast a directory using tclsh shtmlview.tcl *.html
  • reload remembers yview
  • removed web forms and not used css parts to clean up the code
  • moved to own repository on Github

Installation as Tcl-module

Put the directory with the source code somewhere in a directory like /home/username/tcl/shtmlview/shtmlview-1.0.0.tm - in your Tcl code you would now have to write:

 tcl::tm::path add /home/username/tcl
 package require shtmlview::shtmlview

Installation as Tcl package

Just the usual copy of the shtmlview folder into your package path.

See manual page on github for information of installation and usage. Below some example usage for creating a standalone script for viewing local HTML files.

Example

tcl::tm::path add /home/username/tcl
package require shtmlview::shtmlview
if {[info exists argv0] && $argv0 eq [info script]} {
    if {[llength $argv] == 1 && [file exists [lindex $argv 0]]} {
       wm title . "shtmlview widget demo"
       set help [::shtmlview::shtmlview .help \
                  -tablesupport true -home [lindex $argv 0]]
       $help browse [lindex $argv 0] 
       pack $help -side top -fill both -expand true
 } else {
    puts "Usage: $argv0 htmlfile"
    exit 0
 }
}

img_shtmlview

Discussion

Please discuss here.