Registry / serialization / html-void-elements

html-void-elements

JSON →
library0.1.0pypypi✓ verified 23d ago

The `html-void-elements` library provides a Pythonic list of all known HTML void tag names, based on the HTML living standard. Void elements are a special category of HTML elements that do not have closing tags and cannot contain any content or child elements (e.g., `<img>`, `<br>`, `<meta>`). This library is currently at version `0.1.0` and offers a static list for use in parsers, validators, or other HTML processing tools. Its release cadence is infrequent, typically updating only when the underlying HTML standard for void elements changes.

pip install html-void-elements
INSTALL
IMPORT
SIG · HTML-VOID-ELEMENTS
H
html-void-elements
serializationpythonv0.1.0
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

html_void_elements
from HtmlVoidElements import html_void_elements
import html_void_elements
The primary list of void elements is imported as 'html_void_elements' from the 'HtmlVoidElements' module, not directly from the top-level package.

This quickstart demonstrates how to import and print the full list of HTML void element tag names provided by the library.

from HtmlVoidElements import html_void_elements print(html_void_elements) # Expected output: A list of strings, e.g., ['area', 'base', 'br', 'col', 'embed', ...]
Debug
Known issues
gotchaThe package imports the list from `HtmlVoidElements` (capitalized) instead of `html_void_elements` (lowercase) directly. Ensure you use `from HtmlVoidElements import html_void_elements` for correct access.
fix
Change your import statement to `from HtmlVoidElements import html_void_elements`.
affects: 0.1.0
gotchaThe list includes both modern and 'ancient' HTML void tag names (e.g., 'basefont', 'bgsound') based on the comprehensive HTML living standard. If you require a list limited to only currently recommended or widely supported void elements, you may need to filter this list manually.
fix
Filter the `html_void_elements` list to exclude deprecated or niche tags if your application targets a specific, modern HTML subset.
affects: 0.1.0
gotchaIn HTML5, a trailing slash in void elements (e.g., `<img />`) is entirely optional and is ignored by HTML parsers. Using it does not make the tag 'self-closing' in the XML sense within HTML. Misunderstanding this can lead to incorrect expectations about HTML parsing behavior or validation.
fix
Be aware that the list provided is for tag *names*. The library does not enforce or imply any specific syntax for their usage (with or without a trailing slash) beyond listing the names themselves. Always refer to HTML specifications for correct markup.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'html_void_elements'
The `html-void-elements` package has not been installed in your Python environment, or you are trying to import it with an incorrect module name.
fix
Ensure the package is installed using `pip install html-void-elements` and imported correctly with `import html_void_elements`.
SyntaxError: invalid token
You are attempting to import the module using hyphens (`-`) in the import statement, which is invalid Python syntax; Python module names use underscores (`_`) instead.
fix
Replace hyphens with underscores in your import statement: `import html_void_elements` or `from html_void_elements import void_elements`.
ImportError: cannot import name 'VOID_ELEMENTS' from 'html_void_elements'
You are trying to import an attribute (likely `VOID_ELEMENTS`) that does not exist or has incorrect casing within the `html_void_elements` module.
fix
The library exposes the list of void elements as `void_elements` (lowercase). Use `from html_void_elements import void_elements`.
AttributeError: 'list' object has no attribute 'add'
You are attempting to use a method like `add()` on the `void_elements` object, mistakenly treating it as a Python `set` when it is provided as a `list`.
fix
If you need set-like behavior (e.g., for fast lookups or adding unique items), convert the list to a set first: `void_set = set(void_elements)`. To add to a list, use `append()` or `extend()`.
Upgrade
Version history
0.1.0latest on PyPI · released Mar 9, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
18
Resources
html-void-elements — pip install html-void-elements · libregistry