ANN: Webview.jl

Hi, I would like to announce the Webview.jl package that displays the contents of a markdown file in a browser window.

So far, and since I’ve yet learned much about the building package system, it does not install the needed library dependency, but for Windows it points the user to where he/she can download the required dll.

Current usage requires that user provides either the full name of the markdown file or the name of a file that lives in a package docs/src directory. It would be very nice if the package could find files like one can by the “?” helping mechanism. It would also be very, very nice if it could be made to display the @docs strings of a function but I do not know how to make it do that.

Any help to address these limitations is more than welcome.

4 Likes

Are you planning on supporting other formats such as svg?

I recently had the problem that accidentally Julia rendered the documentation as Latex when pressing “?”, so that should totally be doable. I think you have to study how the function display works, see here: I/O and Network · The Julia Language

You might also have to create some temporary files, Julia provides functions tempname and mktemp for this.

1 Like

A helper method like this would be a really cool feature.

1 Like

But that’s what it already does. You just have to give it the full file name or the file being located in current dir.

1 Like

The Webview toolkit seems quite powerful but I’m only using it’s facility to display html (either from file or after converting a markdown text into html). I want also to explore the possibility of using it to display images, but have other things to do before that. What I really wanted next is to learn how to extract the @doc strings from functions and display it in the webview browser window. Like we do from Matlab.

1 Like

Yeah an overload for modules would be nice. But only to avoid joinpath(pathof(Module), "..","..", "README.md")

1 Like

OK, you can do also

doc(pkgname, "README")

where pkgname is the package name whose readme you want displayed. But note that typeof(pkgname) == Module

2 Likes

You can do:

docmd = Base.Docs.doc("sin")
show(stdout, MIME"text/html"(), docmd)

and then replace “sin” with the function name (as string or as a symbol) and stdout with some other io object.

1 Like

OK, I see. Thanks, I’ll go for it as time permits.

1 Like

You can now do

doc(sin)

and see it displayed in the Webview browser window.

1 Like