Is there an HTML string type in Julia?


When working in IJulia I find myself using this code:

struct HtmlString
end, ::MIME"text/html", s::HtmlString) =
           print(io, s.s)
HtmlString("Result: <b>123.4</b")

I can then easily output tables of results as HTML etc. I can build up functions that return lumps of HTML for reports that appear inline in the notebook.

This feels fundamental - is there an HTML string type elsewhere that I’m missing please?

We have LatexStrings.jl, perhaps we should have HtmlStrings.jl?

Perhaps I’m missing a more idiomatic approach? Any wisdom appreciated please.


HTML("Result: <b>123.4</b") in Base.

You can also call display("text/html", "Result: <b>123.4</b") if you just want to show something without constructing a new object.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.