Skip to content
This repository was archived by the owner on Feb 26, 2026. It is now read-only.

Commit 31def35

Browse files
committed
changes to documentation
1 parent b268d15 commit 31def35

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
## UNRELEASED
44

5-
- Clarified the use of SVGs with a new test and changes to documentation.
6-
7-
## UNRELEASED
8-
95
- Introduced the `allowedEmptyAttributes` option, enabling explicit specification of empty string values for select attributes, with the default attribute set to `alt`.
106

7+
- Clarified the use of SVGs with a new test and changes to documentation.
8+
119
## 2.11.0 (2023-06-21)
1210

1311
- Fix to allow `false` in `allowedClasses` attributes. Thanks to [Kevin Jiang](https://github.com/KevinSJ) for this fix!

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,11 @@ allowedAttributes: {
265265

266266
With `multiple: true`, several allowed values may appear in the same attribute, separated by spaces. Otherwise the attribute must exactly match one and only one of the allowed values.
267267

268-
#### "What if I want to prevent attributes and tags from being truly lowercase?"
268+
#### "What if I want to maintain the original case for SVG elements and attributes?"
269269

270-
if you got any tag like `linearGradient` and you want to prevent that tag from being lowercased so you have to pass `lowerCaseTags: false` in `parser` option and same for if you want to prevent any attribute like `viewBox` in svg tag from being lowercased so you have to pass `lowerCaseAttributeNames: false` in parser option.
270+
If you're incorporating SVG elements like `linearGradient` into your content and notice that they're not rendering as expected due to case sensitivity issues, it's essential to prevent `sanitize-html` from converting element and attribute names to lowercase. This situation often arises when SVGs fail to display correctly because their case-sensitive tags, such as `linearGradient` and attributes like `viewBox`, are inadvertently lowercased.
271+
272+
To address this, ensure you set `lowerCaseTags: false` and `lowerCaseAttributeNames: false` in the parser options of your sanitize-html configuration. This adjustment stops the library from altering the case of your tags and attributes, preserving the integrity of your SVG content.
271273

272274
```js
273275
allowedTags: [ 'svg', 'g', 'defs', 'linearGradient', 'stop', 'circle' ],

0 commit comments

Comments
 (0)