messense / messense/nh3

Feature goals compared to Bleach (/ full ammonia API)?

Open
#10 18 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
393
Forks
17
Avg merge
5h 41m
Merged PRs (30d)
1

Description

Discussions are not enabled so opening it here, sorry 'bout it.

With the recent [deprecation of bleach](https://github.com/mozilla/bleach/issues/698) (mostly on grounds of html5lib being unmaintained), unless someone has the time to e.g. rebuild the html5lib API on top of an existing html5 parser and the maintainer of bleach decides to use that, ammonia/nh3 seems well positioned as a migration target (there's already one package which has done that visible from the linked Bleach PR).

One issue there is that nh3 currently provides rather limited tuning knobs compared to Ammonia and Bleach (not sure how the two relate as I have not looked yet), but the readme doesn't really say what your eventual goals would be on that front as maintainer. If you do aim to favor such support & migration, maybe an issue or even project (kanban) about full Ammonia support and / or Bleach features parity (if not API compatibility) could be a consideration?

An other possible issue (though more internal) is for exposing customisations which allow arbitrary callables ([`attribute_filter`](https://docs.rs/ammonia/latest/ammonia/struct.Builder.html#method.attribute_filter) seems to be the only one currently): `nh3` currently releases the GIL during cleanup, which wouldn't allow calling Python functions, and thus exposing a generic `attribute_filter`, I don't know whether Ammonia has parallelism built-in or how much you care about parallel cleaning (though I figure having two paths and only keeping the GIL if callbacks were actually provided would always be an option if a somewhat more annoying one).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the nh3 README and the linked Ammonia Builder::attribute_filter documentation; compare the documented tuning knobs with the requested Ammonia and Bleach parity. Done should be an agreed project goal or scoped plan covering feature support and whether Python callbacks can work while cleanup releases the GIL.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.