HTMLStrings.jl is a Julia package for creating HTML content using a domain-specific language that takes advantage of Julia syntax while still matching HTML in look and feel. It provides a set of functions and types that make it easy to generate HTML in a flexible and expressive manner.
- A comprehensive set of functions for generating HTML tags.
- A custom type
HTMLContent
for representing HTML content. - Easy integration with Pluto.jl notebooks.
- Example Todo App to demonstrate the power of HTMLStrings.jl in building interactive web applications in pure Julia.
using Pkg
Pkg.add("HTMLStrings")
Here's a basic example of how to create and display HTML content using HTMLStrings.jl:
using HTMLStrings
function index(text::String)
return divv(
head(
title("Hello, $text!")
),
body(
h1(:class => "text-lg", "Welcome to HTML.jl"),
p("Generate HTML content with ease using Julia.")
)
)
end
# To return normal HTML string
index("World")
# To display in a Pluto.jl notebook
to_html(index("World"))
In the examples
folder, you'll find a Todo App and a Pluto notebook demonstrating how to use HTMLStrings.jl. Here's how the Todo App looks:
And here's the Pluto notebook in action:
Explore the examples to learn more about the capabilities of HTMLStrings.jl and how you can use it to create dynamic and interactive web content with Julia.