Giter Club home page Giter Club logo

xrb-sanitize's Introduction

XRB::Sanitize

Sanitize markup by adding, changing or removing tags, using the xrb stream processor (which has a naive C implementation).

Development Status

Motivation

I use the sanitize gem and generally it's great. However, it's performance can be an issue and additionally, it doesn't preserve tag namespaces when parsing fragments due to how Nokogiri works internally. This is a problem when processing content destined for utopia since it heavily depends on tag namespaces.

Is it fast?

In my informal testing, this gem is about ~50x faster than the sanitize gem when generating plain text.

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]
Warming up --------------------------------------
            Sanitize   438.000 i/100ms
       XRB::Sanitize     7.935k i/100ms
Calculating -------------------------------------
            Sanitize      4.365k (± 0.1%) i/s -     21.900k in   5.017157s
       XRB::Sanitize     78.670k (± 0.1%) i/s -    396.750k in   5.043233s

Comparison:
       XRB::Sanitize:    78669.9 i/s
            Sanitize:     4365.0 i/s - 18.02x  slower

Usage

Please see the project documentation for more details.

  • Getting Started - This guide explains how to get started with the XRB::Sanitize gem.

Contributing

We welcome contributions to this project.

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create new Pull Request.

Developer Certificate of Origin

This project uses the Developer Certificate of Origin. All contributors to this project must agree to this document to have their contributions accepted.

Contributor Covenant

This project is governed by the Contributor Covenant. All contributors and participants agree to abide by its terms.

xrb-sanitize's People

Contributors

ioquatix avatar

Stargazers

George Kontridze avatar Aurel Branzeanu avatar Marco Roth avatar Yohei Yasukawa avatar Adam Daniels avatar Mauricio Gomes avatar Stanislav (Stas) Katkov avatar Jits avatar Gerald Bauer avatar

Watchers

James Cloos avatar Aurel Branzeanu avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.