Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 1.23 KB

README.md

File metadata and controls

37 lines (29 loc) · 1.23 KB

htmlpp

You probably want a template engine... inja looks nice.
but if you're sure you don't, htmlpp will at least save you typing a few angle brackets.

GitHub Workflow Status Codecov

quick start

#include <html.hpp>

that's it. now you have access to the html:: namespace will all the tags and attributes you expect.

example

a more complete example, see example.cpp for the full source.

    server.run([](auto&& stream) {
        stream << html::indent;
        stream << html::html
            << html::head
            << html::script[html::language("javascript")]
            << "function sayHello() {" << std::endl
            << "  document.getElementById('message').innerHTML = 'Hello, world';" << std::endl
            << "}" << std::endl
            << html::head::end
            << html::body[html::attr("onload", "sayHello()")]
            << html::div[html::id("message")]
            << html::end;
    });
}