Skip to main content

Build html / xhtml with a nice syntax.

Project description

CI PyPi version Python Versions Downloads codestyle black Ruff

tagic

Build html / xhtml with a nice syntax.

Goals

  • generate html / xhtml with a nice syntax
  • have typing support
  • have editor support for arguments, I used MDN as a reference.
  • KISS: no more than generation

Install

> pip install tagic

Example

from tagic.html import *

print(
    html[
      head[
          title["Example Website"],
          meta(
              name="description",
              content="This is an example website build with tagic",
          ),
      ],
      body[
          header(id="header")[h1["Awesome"]],
          main[p["Some text ", span["with tags"], "in between"]],
          footer(hidden=True),
      ],
  ].render(indent=True)
)

Will return

<!DOCTYPE html>
<html>
  <head>
    <title>
      Example Website
    </title>
    <meta content="This is an example website build with tagic" name="description" />
  </head>
  <body>
    <header id="header">
      <h1>
        Awesome
      </h1>
    </header>
    <main>
      <p>
        Some text
        <span>
          with tags
        </span>
        in between
      </p>
    </main>
    <footer hidden />
  </body>
</html>

Similar Projects

  • dominate: missing the typing support and editor support for arguments
  • domonic: to broad of a scope, with parsing, js and style and queries.
  • domini: missing editor support for arguments
  • htmler: missing the typing support and editor support for arguments
  • PyHTML: missing the typing support and editor support for arguments
  • pyhtmlgen: incomplete
  • html: i do not like syntax and missing the typing support and editor support for arguments
  • MarkupPy
  • yattag: i do not like syntax
  • py-microhtml: funny tag names and no editor support for arguments
  • py3html: no editor support for arguments
  • fast-html
  • py2html not in pypi, but i like the syntax and took inspiration

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tagic-1.0.2.tar.gz (12.9 kB view details)

Uploaded Source

File details

Details for the file tagic-1.0.2.tar.gz.

File metadata

  • Download URL: tagic-1.0.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1042-azure

File hashes

Hashes for tagic-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e696891ec32bc5d427f06aa25c9cc96ba1d782d485529badc6f9b844cbb5c0b4
MD5 fb2e5e514a2ad4c6b4cdbf21d94925dc
BLAKE2b-256 800fae79f9e53bba3421b305bc5ca7bf87eb176cd786144fa4974e3c8b5edfd0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page