diff --git a/CHANGELOG.md b/CHANGELOG.md index e973945..f8a35cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 11.0.0-beta.1 +## 11.0.0 - Update to Angular 17. - feat: Add `provideHighlightOptions` function to easily override the default options. diff --git a/README.md b/README.md index 9642fbe..77d173c 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ ___ - [Live Demo](https://ngx-highlight.netlify.com/) | [Stackblitz](https://stackblitz.com/edit/ngx-highlightjs) - [Installation](#installation) - [Usage](#usage) + - [Lazy-load highlight.js script](#usage) + - [Import highlight.js theme](#themes) + - [Highlight usage](#highlight) + - [HighlightAuto usage](#highlight-auto) - [Line numbers addon usage](#line-numbers) - [Plus package](#plus) - [Issues](#issues) @@ -92,6 +96,8 @@ export const appConfig: ApplicationConfig = { | lineNumbersOptions | Set line numbers plugin options | | themePath | The path to the CSS file for the highlighting theme | + + ### Import highlighting theme **Dynamic Approach** @@ -141,12 +147,14 @@ In `angular.json`: Or directly in `src/style.scss`: ```css -@import '~highlight.js/styles/github.css'; +@import 'highlight.js/styles/github.css'; ``` _[List of all available themes from highlight.js](https://github.com/isagalaev/highlight.js/tree/master/src/styles)_ -### Use highlight directive + + +### Highlight Directive Usage To apply code highlighting, use the `highlight` directive. It requires setting the target language, with an optional feature to ignore illegal syntax. @@ -165,7 +173,7 @@ export class AppComponent { } ``` -## Options +#### Options | Name | Type | Description | |----------------------|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| @@ -174,7 +182,10 @@ export class AppComponent { | **[ignoreIllegals]** | boolean | An optional parameter that when true forces highlighting to finish even in case of detecting illegal syntax for the language instead of throwing an exception. | | **(highlighted)** | HighlightResult | Stream that emits the result object when element is highlighted | -### `highlightAuto` directive + + + +### HighlightAuto Directive Usage The `highlightAuto` directive works the same way but automatically detects the language to apply highlighting. @@ -182,18 +193,18 @@ The `highlightAuto` directive works the same way but automatically detects the l import { HighlightAuto } from 'ngx-highlightjs'; @Component({ + standalone: true, selector: 'app-root', template: `
`,
- standalone: true,
imports: [HighlightAuto]
})
export class AppComponent {
}
```
-## Options
+#### Options
| Name | Type | Description |
|---------------------|---------------------|------------------------------------------------------------------------------------------------------------|
@@ -204,9 +215,7 @@ export class AppComponent {
-## Line Numbers
-
-### `lineNumbers` directive
+## Line Numbers Directive Usage
The `lineNumbers` directive extends highlighted code with line numbers. It functions in conjunction with the `highlight` and `highlightAuto` directives.
@@ -215,18 +224,18 @@ import { HighlightAuto } from 'ngx-highlightjs';
import { HighlightLineNumbers } from 'ngx-highlightjs/line-numbers';
@Component({
+ standalone: true,
selector: 'app-root',
template: `
`,
- standalone: true,
imports: [HighlightAuto, HighlightLineNumbers]
})
export class AppComponent {
}
```
-## Options
+#### Options
| Name | Type | Description |
|------------------|---------|--------------------------------------------------------------|
@@ -295,13 +304,13 @@ export const appConfig: ApplicationConfig = {
import { HighlightPlusModule } from 'ngx-highlightjs';
@Component({
+ standalone: true,
selector: 'app-root',
template: `
`,
- standalone: true,
imports: [HighlightPlusModule]
})
export class AppComponent {
@@ -320,6 +329,7 @@ To highlight all files within a gist, iterate through `gist.files` and utilize t
import { HighlightPlusModule } from 'ngx-highlightjs';
@Component({
+ standalone: true,
selector: 'app-root',
template: `
`,
- standalone: true,
imports: [HighlightPlusModule, CommonModule]
})
export class AppComponent {
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000..06bc2a0
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,10 @@
+coverage:
+ status:
+ project:
+ default:
+ target: auto
+ threshold: 1% # Allow up to a 1% decrease in coverage without failing
+ patch:
+ default:
+ target: auto
+ informational: true # Report but do not fail on patch coverage
diff --git a/projects/ngx-highlightjs/README.md b/projects/ngx-highlightjs/README.md
index 9642fbe..77d173c 100644
--- a/projects/ngx-highlightjs/README.md
+++ b/projects/ngx-highlightjs/README.md
@@ -21,6 +21,10 @@ ___
- [Live Demo](https://ngx-highlight.netlify.com/) | [Stackblitz](https://stackblitz.com/edit/ngx-highlightjs)
- [Installation](#installation)
- [Usage](#usage)
+ - [Lazy-load highlight.js script](#usage)
+ - [Import highlight.js theme](#themes)
+ - [Highlight usage](#highlight)
+ - [HighlightAuto usage](#highlight-auto)
- [Line numbers addon usage](#line-numbers)
- [Plus package](#plus)
- [Issues](#issues)
@@ -92,6 +96,8 @@ export const appConfig: ApplicationConfig = {
| lineNumbersOptions | Set line numbers plugin options |
| themePath | The path to the CSS file for the highlighting theme |
+
+
### Import highlighting theme
**Dynamic Approach**
@@ -141,12 +147,14 @@ In `angular.json`:
Or directly in `src/style.scss`:
```css
-@import '~highlight.js/styles/github.css';
+@import 'highlight.js/styles/github.css';
```
_[List of all available themes from highlight.js](https://github.com/isagalaev/highlight.js/tree/master/src/styles)_
-### Use highlight directive
+
+
+### Highlight Directive Usage
To apply code highlighting, use the `highlight` directive. It requires setting the target language, with an optional feature to ignore illegal syntax.
@@ -165,7 +173,7 @@ export class AppComponent {
}
```
-## Options
+#### Options
| Name | Type | Description |
|----------------------|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -174,7 +182,10 @@ export class AppComponent {
| **[ignoreIllegals]** | boolean | An optional parameter that when true forces highlighting to finish even in case of detecting illegal syntax for the language instead of throwing an exception. |
| **(highlighted)** | HighlightResult | Stream that emits the result object when element is highlighted |
-### `highlightAuto` directive
+
+
+
+### HighlightAuto Directive Usage
The `highlightAuto` directive works the same way but automatically detects the language to apply highlighting.
@@ -182,18 +193,18 @@ The `highlightAuto` directive works the same way but automatically detects the l
import { HighlightAuto } from 'ngx-highlightjs';
@Component({
+ standalone: true,
selector: 'app-root',
template: `
`,
- standalone: true,
imports: [HighlightAuto]
})
export class AppComponent {
}
```
-## Options
+#### Options
| Name | Type | Description |
|---------------------|---------------------|------------------------------------------------------------------------------------------------------------|
@@ -204,9 +215,7 @@ export class AppComponent {
-## Line Numbers
-
-### `lineNumbers` directive
+## Line Numbers Directive Usage
The `lineNumbers` directive extends highlighted code with line numbers. It functions in conjunction with the `highlight` and `highlightAuto` directives.
@@ -215,18 +224,18 @@ import { HighlightAuto } from 'ngx-highlightjs';
import { HighlightLineNumbers } from 'ngx-highlightjs/line-numbers';
@Component({
+ standalone: true,
selector: 'app-root',
template: `
`,
- standalone: true,
imports: [HighlightAuto, HighlightLineNumbers]
})
export class AppComponent {
}
```
-## Options
+#### Options
| Name | Type | Description |
|------------------|---------|--------------------------------------------------------------|
@@ -295,13 +304,13 @@ export const appConfig: ApplicationConfig = {
import { HighlightPlusModule } from 'ngx-highlightjs';
@Component({
+ standalone: true,
selector: 'app-root',
template: `
`,
- standalone: true,
imports: [HighlightPlusModule]
})
export class AppComponent {
@@ -320,6 +329,7 @@ To highlight all files within a gist, iterate through `gist.files` and utilize t
import { HighlightPlusModule } from 'ngx-highlightjs';
@Component({
+ standalone: true,
selector: 'app-root',
template: `
`,
- standalone: true,
imports: [HighlightPlusModule, CommonModule]
})
export class AppComponent {
diff --git a/projects/ngx-highlightjs/package.json b/projects/ngx-highlightjs/package.json
index b391f50..402247c 100644
--- a/projects/ngx-highlightjs/package.json
+++ b/projects/ngx-highlightjs/package.json
@@ -1,6 +1,6 @@
{
"name": "ngx-highlightjs",
- "version": "11.0.0-beta.1",
+ "version": "11.0.0",
"description": "Instant code highlighting, auto-detect language, super easy to use.",
"homepage": "http://github.com/murhafsousli/ngx-highlightjs",
"author": {