diff --git a/CHANGELOG.md b/CHANGELOG.md index b4217b6..b32bf81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 4.0.1 + +- fix: Change `r` property name to `relevance` in `HighlightResult` interface, closes [#84](https://github.com/MurhafSousli/ngx-highlightjs/issues/84) in [ce53661](https://github.com/MurhafSousli/ngx-highlightjs/commit/ce536614179a97dbd26a35bd40dd5226f8d6a408). +- fix: Sanitize highlighted code before appending it to the DOM, closes [#101](https://github.com/MurhafSousli/ngx-highlightjs/issues/101) in [9afe6b6](https://github.com/MurhafSousli/ngx-highlightjs/pull/103/commits/9afe6b661255c4e8d6569dec3370843eb34d16de). +- fix: Check if `nativeElement.firstChildElement` is not null before calling line numbers lib, in [494c976](https://github.com/MurhafSousli/ngx-highlightjs/pull/104/commits/494c97616fc6e1b9e965e3910a51214d86837a39). + ## 4.0.0 - feat: Lazy-load **hljs** library, closes [#89](https://github.com/MurhafSousli/ngx-highlightjs/issues/89) in [8cdba13](https://github.com/MurhafSousli/ngx-highlightjs/pull/88/commits/8cdba13d72e563a2189b816d41f959e3dc18be21). diff --git a/projects/ngx-highlightjs/package.json b/projects/ngx-highlightjs/package.json index 440afad..9b1dbee 100644 --- a/projects/ngx-highlightjs/package.json +++ b/projects/ngx-highlightjs/package.json @@ -1,6 +1,6 @@ { "name": "ngx-highlightjs", - "version": "4.0.0", + "version": "4.0.1", "description": "Instant code highlighting, auto-detect language, super easy to use.", "homepage": "http://github.com/murhafsousli/ngx-highlightjs", "author": { diff --git a/projects/ngx-highlightjs/src/lib/highlight.ts b/projects/ngx-highlightjs/src/lib/highlight.ts index 3a29ca1..a06d759 100644 --- a/projects/ngx-highlightjs/src/lib/highlight.ts +++ b/projects/ngx-highlightjs/src/lib/highlight.ts @@ -89,7 +89,7 @@ export class Highlight implements OnChanges { // If lines count is 1, the line numbers library will not add numbers // Observe changes to add 'hljs-line-numbers' class only when line numbers is added to the code element this._lineNumbersObs = new MutationObserver(() => { - if (this._nativeElement.firstElementChild.tagName.toUpperCase() === 'TABLE') { + if (this._nativeElement.firstElementChild && this._nativeElement.firstElementChild.tagName.toUpperCase() === 'TABLE') { this._nativeElement.classList.add('hljs-line-numbers'); } this.destroyLineNumbersObserver();