htmangl

command module
v0.0.0-...-aa006f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 7 Imported by: 0

README

htmangl

A tool for combining HTML files.

This isn't really that smart. It is meant for fairly coarse smashing together of HTML, if you need precision look elsewhere.

But, for instance, let's say you have a template that you want to apply to some pages on a website. So you write template.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My website</title>
    <link rel="stylesheet" href="styles.css" type="text/css" />
  </head>
  <body>
    <header>
      <h1>My website</h1>
    </header>

    <!-- htmangl:insert -->

    <footer>
      Copyright me (this year)
    </footer>
  </body>
</html>

and then write some pages that look a bit like home_partial.html:

<!DOCTYPE html>
<html>
  <head>
    <title> - Home</title>
  </head>
  <body>
    <p>Hey</p>
  </body>
</html>

to end up with what I want:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <title>My website - Home</title>
    <link rel="stylesheet" href="styles.css" type="text/css"/>
  </head>
  <body>
    <header>
      <h1>My website</h1>
    </header>
    
    <p>Hey</p>

    <footer>
      Copyright me (this year)
    </footer>
  </body>
</html>

I just need to run htmangl template.html home_partial.html > home.html.

Documentation

Overview

Command htmangl combines two HTML files.

A way to use this is to make a "template" containing the basic outline of a page and then apply HTML files containing the content to it.

$ htmangl template.html home_partial.html > home.html

Use the special comment "<!-- htmangl:insert -->" to replace with applied child nodes instead of appending to the parent.

Use the special comment "<!-- htmangl:copy -->" to copy all applied children into the parent.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL