axodotdev / axodotdev/axohtml

Allow colons in class names

Open
#38 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
119
Forks
10
PR merge metrics
No merged PRs in 30d

Description

When using class names that contain colons (`:`), I get the following error:

```
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: "class name can only contain alphanumerics, dash, dot and underscore"'
```

This is coming from [this check](https://github.com/axodotdev/axohtml/blob/d2c0379311357f0e9cec591eeeae480f17eec39a/typed-html/src/types/class.rs#L47).

Now, I did not find anything in the HTML spec that actually forbids colons (actually, it allows everything but whitespace). At least colons are quite frequently used for [pseudo classes in tailwind](https://tailwindcss.com/docs/background-color#hover-focus-and-other-states) (e.g. `hover:bg-purple-100`).

So I propose to allow colons for classes (and also ids for good measure, it uses the same check). If you agree, I'll open a pull request, should be easy to change.

UPDATE: I changed it in my fork, works like a charm. I'll open a PR if you want.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.