Metadata-Version: 2.4
Name: markupever
Version: 0.1.1
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python
Classifier: Programming Language :: Rust
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS
Classifier: Typing :: Typed
Requires-Dist: pytest ; extra == 'tests'
Provides-Extra: tests
License-File: LICENSE
Summary: The fast, most optimal, and correct HTML & XML parsing library.
Keywords: markupever,html,xml,parser,markup,selector,cssselect,css
Home-Page: https://github.com/awolverp/markupever
Author: awolverp
Author-email: awolverp <awolverp@gmail.com>
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Source Code, https://github.com/awolverp/markupever.git

<p align="center">
  <img src="https://github.com/user-attachments/assets/4fc58bbf-3fde-47a1-aa42-ae100ba1029a" alt="MarkupEver">
</p>
<p align="center">
    <em>The fast, most optimal, and correct HTML & XML parsing library</em>
</p>
<p align="center">
    <a href="https://awolverp.github.io/markupever" target="_blank"><b>Documentation</b></a> | <a href="https://github.com/awolverp/cachebox/releases"><b>Releases</b></a> | <a href="https://awolverp.github.io/markupever/#performance" target="_blank"><b>Benchmarks</b></a>
</p>

![text](https://img.shields.io/badge/coverage-100-08000)
![image](https://img.shields.io/pypi/v/markupever.svg)
![image](https://img.shields.io/pypi/l/markupever.svg)
![image](https://img.shields.io/pypi/pyversions/markupever.svg)
![python-test](https://github.com/awolverp/markupever/actions/workflows/test.yml/badge.svg)

------

MarkupEver is a modern, fast (high-performance), XML & HTML languages parsing library written in Rust.

**KEY FEATURES:**
* 🚀 **Fast**: Very high performance and fast (thanks to **[html5ever](https://github.com/servo/html5ever)** and **[selectors](https://github.com/servo/stylo/tree/main/selectors)**).
* 🔥 **Easy**: Designed to be easy to use and learn. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere.
* ✨ **Low-Memory**: Written in Rust. Uses low memory. Don't worry about memory leaks. Uses Rust memory allocator.
* 🧶 **Thread-safe**: Completely thread-safe. 
* 🎯 **Quering**: Use your **CSS** knowledge for selecting elements from a HTML or XML document.

## Installation
You can install MarkupEver by using **pip**:

<small>It's recommended to use virtual environments.</small>

```console
$ pip3 install markupever
```

## Example

### Parse
Parsing a HTML content and selecting elements:

```python
import markupever as mr

dom = mr.parse_file("file.html", mr.HtmlOptions())
# Or parse a HTML content directly:
# dom = markupever.parse("... content ...", mr.HtmlOptions())

for element in dom.select("div.section > p:child-nth(1)"):
    print(element.text())
```

### Create DOM
Creating a DOM from zero:

```python
from markupever import dom

dom = dom.TreeDom()
root: dom.Document = dom.root()

root.create_doctype("html")

html = root.create_element("html", {"lang": "en"})
body = html.create_element("body")
body.create_text("Hello Everyone ...")

print(root.serialize())
# <!DOCTYPE html><html lang="en"><body>Hello Everyone ...</body></html>
```

# TODO List
- [x] Rewrite TreeDom `__repr__` and `__str__`
- [x] Write benchmarks
- [x] Write memory usage
- [x] Add PyPI version, test coverage, and python versions badges
- [x] Complete docs
- [ ] Add prettier feature
- [ ] Provide more control on serializer
- [ ] Add advanced examples to docs (such as socket and http streams)

