From b125bec9914bd211d77719bd60bc5a23bd9db579 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sat, 19 Aug 2023 13:17:30 +0200 Subject: break!: remove DefaultEmitter from public API --- Cargo.toml | 4 ++++ README.md | 3 ++- src/emitter.rs | 10 +++++----- src/lib.rs | 5 ++++- tests/test_spans.rs | 1 + 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9331152..002e9f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,10 @@ repository = "https://git.push-f.com/html5tokenizer" version = "0.4.0" include = ["src/**/*", "LICENSE", "README.md"] +[[example]] +name = "tokenize" +required-features = ["integration-tests"] + [dev-dependencies] codespan-reporting = "0.11.1" insta = "1.31.0" diff --git a/README.md b/README.md index ccb2757..ce68663 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ `html5tokenizer` is a WHATWG-compliant HTML tokenizer (forked from [html5gum] with added code span support). -```rust + +```ignore use std::fmt::Write; use html5tokenizer::{DefaultEmitter, Tokenizer, Token}; diff --git a/src/emitter.rs b/src/emitter.rs index 30e1d17..0985403 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -165,14 +165,13 @@ pub trait Emitter { fn adjusted_current_node_present_and_not_in_html_namespace(&mut self) -> bool; } -/// The default implementation of [`Emitter`], used to produce tokens. -/// -/// # Warning +/// The DefaultEmitter is not exposed in the public API because: /// /// * Using the DefaultEmitter without calling [`Tokenizer::set_state`] /// results in wrong state transitions: /// -/// ``` +#[cfg_attr(not(feature = "integration-tests"), doc = "```ignore")] +#[cfg_attr(feature = "integration-tests", doc = "```")] /// # use html5tokenizer::{DefaultEmitter, Tokenizer, Token}; /// let emitter = DefaultEmitter::default(); /// let html = "