Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strange behaviour of shtmlview

54 views
Skip to first unread message

Helmut Giese

unread,
Jul 6, 2022, 3:14:05 PM7/6/22
to
Hello out there,
I want to use shtmlview for showing little help texts during a series
of configuration screens. To get familiar with markdown I devised the
script below to get immediate feedback as I ventured along learning
markdown.
To my surprise the shtmlview window remains empty whereas the
generated HTML file looks ok and displays fine in my Firefox. The
greatest surprise, however, happened when I had the empty text widget
display its content: It showed all the text with the markdown
'markers' removed (The '===' and the '###') and a nicely formatted
list, too.
How can this be? And what can I do about it?
Any help or idea will be greatly appreciated.
A slightly puzzled
Helmut

This is my Tcl file (mkdoc.tcl):
----
package require mkdoc

if {! [info exists hlp]} {
package require shtmlview::shtmlview
set hlp [shtmlview::shtmlview .hlp -toolbar 0]
}

proc mkdoc {in hlp} {
set out [file rootname $in].html
mkdoc::mkdoc $in $out
$hlp browse $out
}
mkdoc [lindex $argv 0] $hlp
puts "Content: '[$hlp helptext get 1.0 end]'"
----
and this a sample file passed to it (sample.md):
----
A sample for 'markdown'
=======================

This sample tries to understand markdown.

### Lists

Markdown supports ordered (numbered) and unordered (bulleted) lists.
Unordered lists use asterisks, pluses, and hyphens -- interchangably
-- as list markers:

* Red
* Green
* Blue
----

greg

unread,
Jul 7, 2022, 11:17:51 AM7/7/22
to
Helmut Giese schrieb am Mittwoch, 6. Juli 2022 um 21:14:05 UTC+2:

> This is my Tcl file (mkdoc.tcl):

> package require mkdoc
>
>
> proc mkdoc {in hlp} {


name of the tcl file (mkdoc.tcl) other than the proc. and package

Gregor

D Groth

unread,
Jul 7, 2022, 11:38:09 AM7/7/22
to
You did not pack the widget as far as I can see.

BTW: Which version of shtmlview you are using? That from the github-repo https://github.com/mittelmark/shtmlview or that from tklib-repo?

Detlef

Helmut Giese

unread,
Jul 7, 2022, 3:52:05 PM7/7/22
to
D Groth <tbgr...@gmail.com> schrieb:

> You did not pack the widget as far as I can see.
>
>BTW: Which version of shtmlview you are using? That from the github-repo https://github.com/mittelmark/shtmlview or that from tklib-repo?
>
>Detlef
Hi Detlef,
this was it in fact. Once I packed it it showed up in all its glory.
What a stupid mistake.
Many thanks for spotting it - and for this package, too.
From where did I get it? I don't know. I remembered a thread here in
clt several months ago, found it and then somehow got it. It has a
file size of 146.329 and says
package provide shtmlview::shtmlview 1.1.0

Thanks again and best regards
Helmut
PS: Checking the github address you gave above I found that I have
exact this version:

D Groth

unread,
Jul 8, 2022, 12:37:29 AM7/8/22
to
Sometimes we loose so much time on the easy, stupid errors ...
BTW: In the later versions you can toggle between view and edit mode using Ctrl-Shift-e (Ctrl-E) for editing and Ctrl-s for saving, Ctrl-r for reloading, see the manual page. The editor is just a simple text widget but sufficient for small changes.
The widget will be part of the next Tklib release.
Detlef

D Groth

unread,
Jul 8, 2022, 12:50:09 AM7/8/22
to
PS: You can as well render and edit directly Markdown files, just running the shtmlview.tcl file directly from the terminal:
`tclsh shtmlview.tcl sample.md` In Tklib the application is separated from the widget, `shtmlview sample.md` should do the trick then.
0 new messages