Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
An HTML templating system for C++ that transpiles .htcpp files into C++ rendering code.
hypertextcpp is an HTML templating system for C++ applications that transpiles an .htcpp template file into C++ code for rendering HTML.
hypertextcpp is a command-line tool that converts .htcpp template files into C++ rendering code. It accepts a template containing HTML markup with embedded C++ expressions, statements, control-flow extensions, sections, and procedures, and produces either a single C++ header, a header-plus-source pair, or a shared-library source file. The tool is developed by kamchatka-volcano and is distributed under the MS-PL license. Generated code targets C++17 and integrates with CMake through provided helper functions.
std::ostream directly into the HTML using $(...) syntax, such as $(cfg.name).?(condition) to an opening or closing tag to render that element only when the condition is true.@(auto item : range) or a classic for-loop specification to a tag to repeat the element over a range or loop.[[ ... ]] with an optional condition to control attribute inclusion or partial rendering.#name() that capture the cfg variable and can be called directly from C++ to render partial content.hypertextcpp_GenerateHeader, hypertextcpp_GenerateHeaderAndSource, and hypertextcpp_BuildSharedLibrary are provided.C++ developers who want compile-time checked HTML templates without a runtime template engine. It suits teams building web applications in C++ that need fast, type-safe rendering, as well as developers generating static HTML pages from C++ programs. The shared-library mode also fits projects that need to update page templates without recompiling the entire application.
.htcpp file changes.You write an .htcpp file with HTML and embedded C++ elements, then run the hypertextcpp command-line tool to transpile it into C++ code. The generated renderer is included in your project and called with a config object containing the data to render; CMake integration functions trigger regeneration during the build.
Yes, hypertextcpp is open-source and licensed under the MS-PL license.
The generated code and examples use C++17; the CMake example sets target_compile_features(... PUBLIC cxx_std_17).
Yes, using the shared library generation mode, a template library can be rebuilt and reloaded dynamically, though this mode sacrifices compile-time type safety because the config structure must be duplicated and runtime errors abort the program on mismatch.
Three: single header, header and source pair, and shared library source; the header-only mode is the simplest to integrate.