mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00

Committing for reference; will roll back afterwards. This adds approximately 150k to the bundled .js file in release mode. html-sanitizer might be useful to replace our custom paste filtering code in the future, but for now I'm not sure it's worth the extra page load time over doing the filtering in Rust.
11 lines
300 B
TypeScript
11 lines
300 B
TypeScript
import sanitizeHtml from "sanitize-html";
|
|
|
|
export function basicHtml(html: string): string {
|
|
return sanitizeHtml(html, {
|
|
allowedTags: ["b", "i", "em", "strong", "a", "img", "div", "br"],
|
|
allowedAttributes: {
|
|
a: ["href"],
|
|
img: ["src"],
|
|
},
|
|
});
|
|
}
|