Skip to main content

PyPI version

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>&lt;body&gt;</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)

Source distribution for htmlwhat 1.0.2
File Size Uploaded
htmlwhat-1.0.2.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for htmlwhat 1.0.2
File Interpreter ABI Platform
htmlwhat-1.0.2-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page