Files
brave-core/components/speedreader/rust/lib
Claudio DeSouza 81087f4eb6 [cr136][rust] Several crates dropped from the main tree
There's no need to patch off the crate `test_only` value anymore as the
crate is now gone from the upstream tree.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/3eac73aa297e57a1d6e17bec25973848d16e91a4

commit 3eac73aa297e57a1d6e17bec25973848d16e91a4
Author: Lukasz Anforowicz <lukasza@chromium.org>
Date:   Mon Mar 24 15:12:42 2025 -0700

    [rust] Remove unneeded, grandparented-in, direct Rust crate deps.

    This CL removes dependencies from
    `third_party/rust/chromium_crates_io/Cargo.toml` that have been
    grand-parented-in in https://crrev.com/c/5019147, but that do not seem
    to have any direct dependencies from Chromium targets.

    The CL has been created by:

    * Manually editing `third_party/rust/chromium_crates_io/Cargo.toml`
      and `third_party/rust/chromium_crates_io/gnrt_config.toml`
    * Running:
        - `tools/crates/run_gnrt.py vendor`
        - `tools/crates/run_gnrt.py gen`

    Bug: 405468274
2025-04-16 09:30:30 +01:00
..

Brave SpeedReader

At a high level, SpeedReader:

  • Distills text-focused document content from a suitable HTML
  • Works on HTML documents before rendering them
  • Generates HTML output with no external styling or scripting
  • Content styled with Brave-designed themes

Structure

SpeedReader decides whether a page is suitable for distillation, or 'readable', based on a classifier that analyses HTML content of a page and applies a pre-trained model to decide whether the page is article-style, text-oriented, and so on.

Any page that is readable should then be passed to an instance of SpeedReader. Internally it uses heuristics to determine whether to apply streaming, rule-based rewriting (using lol_html), or an approach derived from the readability crate, itself loosely based on Mozilla's Readability.js.

Running the tests

You need to clone the speedreader test data to the components/speedreader/rust/lib directory.

$ git clone https://github.com/brave-experiments/speedreader-test-data data
$ cargo test