Skip to content
This repository was archived by the owner on Sep 24, 2026. It is now read-only.
This repository was archived by the owner on Sep 24, 2026. It is now read-only.

No public API yet — crate isn't usable as a published dependency #3

Description

@casoon

Problem

Everything in this crate is pub(crate): parse(), Document, NodeId, NodeKind, Attribute, Position. This is deliberate per the project's Step 1 scope (see CLAUDE.md/README's "Scope" section) — building only what html-conform needs, no premature public API — but as a consequence, the crate can't be depended on by anything outside itself yet, including html-conform, even though that's the entire reason the project exists.

Solution path

This is Step 2 of the plan already described in README.md/CLAUDE.md, but it doesn't have to be "the big generic extraction" all at once — split it:

  1. Minimal pub surface for html-conform integration (near-term, unblocks the actual reason this crate exists):
    • pub fn parse(input: &str) -> Document in lib.rs.
    • pub the Document/NodeId/NodeKind/Attribute/Position types and their accessor methods (Document::root, Document::children, Document::node, Document::parent, ...) — just what an html-conform::infoset::normalize()-equivalent needs to walk the tree, nothing from Tokenizer/TreeBuilder internals.
    • Add rustdoc comments to the newly-public surface (current doc comments were written for an internal audience; review them with an external reader in mind).
    • Keep Tokenizer/TreeBuilder and everything else pub(crate) — no reason to commit to their shape publicly yet.
  2. Validate against html-conform's real usage: once html-conform can actually depend on this crate (path or git dependency first, not necessarily published to crates.io yet), write the adapter layer in html-conform's own repo (its src/infoset.rs-equivalent) that replaces its current HTML5-parsing dependency, and run html-conform's existing test suite against it. This is explicitly cross-repo work — not something this repo's issue tracker should try to own end to end — but this issue can track whether the pub surface from step 1 turns out to be sufficient, and adjust based on what that integration actually needs.
  3. Full generic extraction (the actual "Step 2"): only after step 2 above is proven, revisit whether to extract a fully generic, html-conform-agnostic WHATWG tokenizer/tree-builder as this crate's real public API (per the two-stage plan) — e.g. exposing Tokenizer/TreeBuilder themselves, supporting fragment parsing, etc. Track as a separate, later issue once there's real signal for what "generic" needs to mean in practice, not speculatively.
  4. Once there's a real pub surface, publish to crates.io (currently explicitly not published, per README).

Recommend tackling step 1 first — it's small, mechanical, and is the actual blocker for html-conform integration.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions