Socket
Book a DemoInstallSign in
Socket

@personio/html-sanitizer

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@personio/html-sanitizer

A helper library used in Personio UI to sanitize HTML content. Written in TypeScript.

1.1.0
latest
npmnpm
Version published
Weekly downloads
2
100%
Maintainers
4
Weekly downloads
 
Created
Source

@personio/html-sanitizer

A helper library used in Personio UI to sanitize HTML content. Written in TypeScript.

Installation

Run

yarn add @personio/html-sanitizer

Usage

There are two ways to use this library:

As hook

import * as React from 'react';
import { useHTMLSanitizer } from '@personio/html-sanitizer';

type Props = {
  htmlContent: string;
}

const MyComponent = ({ htmlContent }: Props) => {
  const sanitized = useHTMLSanitizer({ html: htmlContent });
  
  return (
    <div
      dangerouslySetInnerHTML={{
        __html: sanitized,
      }}
    />
  );
}

As Component (using hook under the hood)

import * as React from 'react';
import { HTMLSanitizer } from '@personio/html-sanitizer';

type Props = {
  htmlContent: string;
}

const MyComponent = ({ htmlContent }: Props) => {
  return <HTMLSanitizer html={htmlContent} as="span" />;
}

FAQs

Package last updated on 23 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.