No description
Find a file
2025-09-04 09:16:39 +02:00
cattag sugar html attribute now supports HtmlAttribute as first arg 2025-09-04 09:16:39 +02:00
examples version bump and readme 2025-08-29 09:25:32 +02:00
tests sugar html attribute now supports HtmlAttribute as first arg 2025-09-04 09:16:39 +02:00
.gitignore added mdn data as submodule 2025-08-07 09:08:03 +02:00
.gitmodules added mdn data as submodule 2025-08-07 09:08:03 +02:00
cattag.nim small restructure for doc gen 2025-08-29 09:13:43 +02:00
cattag.nimble sugar html attribute now supports HtmlAttribute as first arg 2025-09-04 09:16:39 +02:00
README.md readme 2025-08-29 09:51:10 +02:00

CatTag

Warning

This project is still in heavy development.

About

A static HTML/XML and CSS generator from Nim code. For cats (humans are tolerated).

This is the successor to my other/old HTML/XML/CSS generator websitegenerator rewritten (more like reimplemented with major changes, so like, idk how you would call that... remade?) and enhanced.

Installation

Include the following line in your .nimble file: requires "https://github.com/nirokay/CatTag"

or

git clone https://github.com/nirokay/CatTag && cd CatTag && nimble install and include required "cattag" in your .nimble file.

Examples

Feel free to explore the examples subdirectory!

Basic example

This is a very basic example, only showing off HTML generation.

import cattag

var html: HtmlDocument = newHtmlDocument("index.html")

html.add(
    h1(html"Cats"),
    p(html"Cool stuff about cats."),
    h2(html"Facts"),
    ul(
        li(html"cats are cool!"),
        li(html"cats are the best")
    )
)

html.writeFile()
<!DOCTYPE html>
<html>
    <head></head>
    <body>
        <h1>Cats</h1>
        <p>Cool stuff about cats.</p>
        <h2>Facts</h2>
        <ul>
            <li>cats are cool!</li>
            <li>cats are the best</li>
        </ul>
    </body>
</html>

Roadmap

Planned features

  • HTML/XML Generation
  • CSS Generation
  • HTML/XML sugar syntax
  • CSS sugar syntax
  • HTML QoL attribute constants (class, lang, id, ...)
  • HTML QoL procs (p("text") for newHtmlElement("p", "text"))
  • CSS QoL property constants (text-align, background-color, ...)
  • CSS QoL property and property value constants (center, Red, ...)
  • CSS QoL procs
  • DOM procs
  • HtmlElement.style field stuff (usage similar to typescript element style manipulation)

Distant future ideas

  • HTML/XML Parsing
  • CSS Parsing

License

This project is licenced under the GPL-3.0 license.