Skip to content

Commit

Permalink
v1.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-dukhovnyy committed Jan 22, 2024
1 parent 4a053ef commit eb07a62
Show file tree
Hide file tree
Showing 29 changed files with 3,669 additions and 986 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
# package-lock.json
coverage
coverage
*.ignore.*
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
https://github.com/Aleksandr-JS-Developer/purify-html/discussions.
https://github.com/oleksandr-dukhovnyy/purify-html/discussions.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The algorithm for making a contribution is somewhat different, depending on the

## PR aimed at fixing vulnerabilities.

Follow the link `https://github.com/Aleksandr-JS-Developer/purify-html/security/advisories/new` and fill out the form. If you are not sure how to fill out the form - just write what you can. Please allow time for correction (or correct it yourself) before posting any information publicly.
Follow the link `https://github.com/oleksandr-dukhovnyy/purify-html/security/advisories/new` and fill out the form. If you are not sure how to fill out the form - just write what you can. Please allow time for correction (or correct it yourself) before posting any information publicly.

## PR aimed at adding new functionality.

Expand Down Expand Up @@ -41,9 +41,8 @@ First - create fork.
Second - download project & install depends

```bash
mkdir purify-html
git clone <fork-repo>
cd purify-html
git clone <fork-repo> .
npm install
npm run test
```
Expand Down
44 changes: 42 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ yarn add purify-html
CDN

```html
<script src="https://cdn.jsdelivr.net/npm/purify-html/dist/index.browser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/purify-html/dist/index.es.js"></script>

<!-- or -->

Expand Down Expand Up @@ -256,7 +256,7 @@ console.log(safeString);
<!-- ... -->
<head>
<!-- ... -->
<script src="https://unpkg.com/purify-html@latest/dist/index.browser.js"></script>
<script src="https://unpkg.com/purify-html@latest/dist/index.es.js"></script>
</head>

<!-- ... -->
Expand Down Expand Up @@ -306,6 +306,46 @@ const sanitizer = new PurifyHTML(rules);
sanitizer.sanitize(/* ... */);
```

## node-js

When used in an environment where the standard DOMParser is absent, you need to install a parser manually.

For example:

```js
import { JSDOM } from 'jsdom';
global.DOMParser = new JSDOM().window.DOMParser;

import PurifyHTML from 'purify-html';
const sanitizer = new PurifyHTML(); // works
```

Or

```js
import { JSDOM } from 'jsdom';
import PurifyHTML, { setParser } from 'purify-html';

// Scope elem variable, reuse DOMParser instance for performance
{
const elem: Element = new DOMParser()
.parseFromString('', 'text/html')
.querySelector('body');

// Set methods
setParser({
parse(string: string): Element {
elem.innerHTML = string;

return elem;
},
stringify(elem: Element): string {
return elem.innerHTML;
},
});
}
```

## setParser

In some cases, you may want to be able to use your parser instead of DOMParser.
Expand Down
10 changes: 5 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Supported Versions

| Version | Supported |
| ------- | ------------------ |
| 1.x.x | :white_check_mark: |
| 0.x.x | :x: |
| Version | Supported |
| -------------- | ------------------ |
| ^1.5.4 - 1.x.x | :white_check_mark: |
| 0.x.x - 1.5.3 | :x: |

## Reporting a Vulnerability

Follow the link `https://github.com/Aleksandr-JS-Developer/purify-html/security/advisories/new` and fill out the form. If you are not sure how to fill out the form - just write what you can. Please allow time for correction (or correct it yourself) before posting any information publicly.
Follow the link `https://github.com/oleksandr-dukhovnyy/purify-html/security/advisories/new` and fill out the form. If you are not sure how to fill out the form - just write what you can. Please allow time for correction (or correct it yourself) before posting any information publicly.
2 changes: 1 addition & 1 deletion dist/core.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions dist/index.browser.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.browser.d.ts.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.browser.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/index.esm.d.ts → dist/index.es.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PurifyHTML, setParser } from './core';
export { setParser };
export { setParser, PurifyHTML as sanitizer };
export default PurifyHTML;
//# sourceMappingURL=index.esm.d.ts.map
237 changes: 237 additions & 0 deletions dist/index.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/index.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.esm.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eb07a62

Please sign in to comment.