Coder Social home page Coder Social logo

lucacasonato / ammonia-wasm Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 3.0 2.75 MB

WASM bindings for the Ammonia HTML sanitizer

Home Page: https://deno.land/x/ammonia

License: MIT License

TypeScript 57.89% Makefile 0.19% JavaScript 28.23% Rust 13.69%
deno html5 sanitizer wasm

ammonia-wasm's People

Contributors

lucacasonato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ammonia-wasm's Issues

Update to `3.2.0` of Ammonia.

The current version of Ammonia that is used by this package is quite a bit behind (This is on version 3.1.0). Please try to update to the latest version, if possible.

Incorrect type of 'setTagAttributeValues' property

The setTagAttributeValues property of the AmmoniaBuilder class expects a value of type Map<string, Map<string, Set<string>>> [link]. But the same property in rust-ammonia expects the type Map<string, Map<string, string>>[link]. This leads to an error when trying to set this property on instance of the AmmoniaBuilder class.

Changing the type of setTagAttributeValues to Map<string, Map<string, string>> resolves this issue. Please fix this bug. I can also raise a PR if that helps.

Document need to run `init` better

Please document the need to run init better.

Readme has it in the example, but that's very easy to skip.

Especially, if like me, you were reading https://doc.deno.land/https://deno.land/x/[email protected]/mod.ts in the first place.

$ deno --version
deno 1.22.0 (release, x86_64-unknown-linux-gnu)
v8 10.0.139.17
typescript 4.6.2
$ deno eval 'import {clean} from "https://deno.land/x/[email protected]/mod.ts"; const input = "foo"; const output = clean(input); console.log({output});'
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '__wbindgen_add_to_stack_pointer')
        wasm.__wbindgen_add_to_stack_pointer(16);
             ^
    at clean (https://deno.land/x/[email protected]/pkg/ammonia_wasm.js:116:14)
    at clean (https://deno.land/x/[email protected]/mod.ts:38:10)
    at file:///tmp/$deno$eval.js:1:101

"How to use" example code incorrect?

I had to change the last line to of the code to the following, otherwise the new settings created with AmmoniaBuilder are not used.

cleaner.clean("foo<p>bar</p>");

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.