Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shahriyardx/py-easy-html

Generate HTML using python and also convert to PDF
https://github.com/shahriyardx/py-easy-html

Last synced: 9 days ago
JSON representation

Generate HTML using python and also convert to PDF

Awesome Lists containing this project

README

        

# Easy HTML
Generate HTML using python and also convert to PDF.

# Installation
```sh
pip install py-easy-html
```

# Getting started
General usage
```py
h1 = generate_tag('h1', body='This is a h1', class_name="your_class", id_name="your_id", self_closing=False)
```
> Output
```html

This is a h1


```

You can also do nested tags
```py
h1 = generate_tag('h1', body=generate_tag('span', body='Span inside h1'))
```
> Output
```html


Span inside h1


```

And also multiple nested tags
```py
h1 = generate_tag(
'h1',
style={
"display": "flex",
"justify-content": "space-between",
"align-items": "center",
},
body=[
generate_tag('span', body='First Span'),
generate_tag('span', body='Second'),
],
)
```
> Output
```html


First Span
Second


```