htmlwhat
htmlwhat is a Python module that provides feedback on incorrect HTML code submissions. It's often used in educational platforms where students submit HTML code as part of their assignments or exercises.
Installation
# latest stable version from PyPi
pip install htmlwhat
# latest development version from GitHub
pip install git+https://github.com/arlarse/htmlwhat
Quick Start
from htmlwhat.test_exercise import test_exercise
userhtml = """
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body class="hello">
<h1>My First Heading</h1>
</body>
</html>
"""
solutionhtml = """
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body class="example">
<h1>My First Heading</h1>
</body>
</html>
"""
test = "Ex().check_body().has_equal_attr()"
print(test_exercise(
test,
userhtml,
solutionhtml,
))
Output:
{'correct': False, 'message': 'Inspect the <code><body></code> tag. Expected attribute <code>class</code> to be <code>"example"</code>, but found <code>"hello"</code>.'}
Problems after installation
htmlwhat built over protowhat which uses jinja2==2.11.3, and jinja uses MarkupSafe==2.0.1.
Hence you will face this error
ImportError: cannot import name 'soft_unicode' from 'markupsafe'
so install the latest version of jinja2 using the following command:
pip install --upgrade jinja2
Metadata
Release files for htmlwhat 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| htmlwhat-1.0.2.tar.gz | 13.8 kB | Without provenance | Details for htmlwhat-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| htmlwhat-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for htmlwhat-1.0.2-py3-none-any.whl |
Total release size: 30.6 kB
Release files / htmlwhat-1.0.2.tar.gz
| Download URL | htmlwhat-1.0.2.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
008c32a37c5cdc44b997bfc95bca5477c3e5559dbc375cadb0c97f7b6734d2cf
|
|
BLAKE2b-256 checksum How to use checksums |
1cd54d9a770e352729d064d2d9eb1e903264587ece8bd2e99459ec9459e40612
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.10
|
Release files / htmlwhat-1.0.2-py3-none-any.whl
| Download URL | htmlwhat-1.0.2-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d2044cf13b208945764974d406dbb62a8ada5ebbe84990a67b4ab12136db000
|
|
BLAKE2b-256 checksum How to use checksums |
3c85920fa14ba378fdd2d272eb3655c54548c13beeb0f159faa146e6afebb6cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.10
|
Security for htmlwhat 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.