neat-html


Nameneat-html JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/SamDudley/neat-html
SummaryA python library for writing and composing HTML.
upload_time2024-07-17 13:25:48
maintainerNone
docs_urlNone
authorSam Dudley
requires_python<4.0,>=3.10
licenseMIT
keywords html
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # neat-html

A python library for writing and composing HTML.

Features:

- small API to learn
- fully typed API (strict mypy)
- produces "neatly" formatted HTML
- written in pure python
- zero dependencies
- comprehensive test suite (100% coverage)
- no recursion

## Example

Code:

```python
from neat_html import h, render

greeting = h("strong", {"style": {"color": "green"}}, "Hello")
html = h("p", {"id": "foo"}, [greeting, ", World!"])
print(render(html))
```

Output:

```html
<p id="foo">
    <strong style="color: green">Hello</strong>, World!
</p>
```

## Installation

Using [pip](https://pip.pypa.io/en/stable/):

```bash
pip install neat-html
```

Using [poetry](https://python-poetry.org/):

```bash
poetry add neat-html
```

Using [uv](https://github.com/astral-sh/uv):

```bash
uv pip install neat-html
```

## User guide

### Basics

```python
from neat_html import Element, h, render

# define an element
button: Element = h("button", "Submit")
# render the element to html
html: str = render(button)
```

## Integrations

### Django

#### django-neat-html

https://github.com/SamDudley/django-neat-html

A work in progress library that integrates neat-html into Django as a template backend.

## API

I would recommend taking a look at the source code for the details of the API.

The best place to start would be in [neat_html/\_\_init\_\_.py](neat_html/__init__.py).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SamDudley/neat-html",
    "name": "neat-html",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "html",
    "author": "Sam Dudley",
    "author_email": "dudley.co.uk@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a6/9b/25035adb04b36a2fd004ea3fc8bd2f6c62dd7913d89174e5730db908d8a0/neat_html-0.6.0.tar.gz",
    "platform": null,
    "description": "# neat-html\n\nA python library for writing and composing HTML.\n\nFeatures:\n\n- small API to learn\n- fully typed API (strict mypy)\n- produces \"neatly\" formatted HTML\n- written in pure python\n- zero dependencies\n- comprehensive test suite (100% coverage)\n- no recursion\n\n## Example\n\nCode:\n\n```python\nfrom neat_html import h, render\n\ngreeting = h(\"strong\", {\"style\": {\"color\": \"green\"}}, \"Hello\")\nhtml = h(\"p\", {\"id\": \"foo\"}, [greeting, \", World!\"])\nprint(render(html))\n```\n\nOutput:\n\n```html\n<p id=\"foo\">\n    <strong style=\"color: green\">Hello</strong>, World!\n</p>\n```\n\n## Installation\n\nUsing [pip](https://pip.pypa.io/en/stable/):\n\n```bash\npip install neat-html\n```\n\nUsing [poetry](https://python-poetry.org/):\n\n```bash\npoetry add neat-html\n```\n\nUsing [uv](https://github.com/astral-sh/uv):\n\n```bash\nuv pip install neat-html\n```\n\n## User guide\n\n### Basics\n\n```python\nfrom neat_html import Element, h, render\n\n# define an element\nbutton: Element = h(\"button\", \"Submit\")\n# render the element to html\nhtml: str = render(button)\n```\n\n## Integrations\n\n### Django\n\n#### django-neat-html\n\nhttps://github.com/SamDudley/django-neat-html\n\nA work in progress library that integrates neat-html into Django as a template backend.\n\n## API\n\nI would recommend taking a look at the source code for the details of the API.\n\nThe best place to start would be in [neat_html/\\_\\_init\\_\\_.py](neat_html/__init__.py).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A python library for writing and composing HTML.",
    "version": "0.6.0",
    "project_urls": {
        "Homepage": "https://github.com/SamDudley/neat-html",
        "Repository": "https://github.com/SamDudley/neat-html"
    },
    "split_keywords": [
        "html"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "84271b235fb14471034f52a2ba3ade6d5baf74d52f0c818eb274773fea585638",
                "md5": "4060c4f71b7ceb6b12b12338969a087c",
                "sha256": "46415282a6eb8f08d92ac5a3cb4af0e445655b015bd80c9ec5790273d40b9558"
            },
            "downloads": -1,
            "filename": "neat_html-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4060c4f71b7ceb6b12b12338969a087c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 7298,
            "upload_time": "2024-07-17T13:25:47",
            "upload_time_iso_8601": "2024-07-17T13:25:47.610054Z",
            "url": "https://files.pythonhosted.org/packages/84/27/1b235fb14471034f52a2ba3ade6d5baf74d52f0c818eb274773fea585638/neat_html-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a69b25035adb04b36a2fd004ea3fc8bd2f6c62dd7913d89174e5730db908d8a0",
                "md5": "00844ed97c75f6f4a0de6a5908e2794c",
                "sha256": "20b3f3f6f2971928677dda829b2910f668fb8b5fb25b100602ff5d8e72b1ea7d"
            },
            "downloads": -1,
            "filename": "neat_html-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "00844ed97c75f6f4a0de6a5908e2794c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 5790,
            "upload_time": "2024-07-17T13:25:48",
            "upload_time_iso_8601": "2024-07-17T13:25:48.916151Z",
            "url": "https://files.pythonhosted.org/packages/a6/9b/25035adb04b36a2fd004ea3fc8bd2f6c62dd7913d89174e5730db908d8a0/neat_html-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-17 13:25:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SamDudley",
    "github_project": "neat-html",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "neat-html"
}
        
Elapsed time: 0.92413s