Skip to content

Commit 5c7b898

Browse files
committed
chore: improve documentation
1 parent 3625f9b commit 5c7b898

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55

66
[![Edit ngx-annotate-text demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/ngx-annotate-text-demo-sgb4t1?fontsize=14&hidenavigation=1&module=%2Fsrc%2Fapp%2Fapp.component.html&theme=dark)
77

8-
An Angular component library for interactively highlighting / annotating parts of text.
8+
This Angular component library is perfect for tasks like visualizing named entity recognition, part of speech tagging, or annotating text datasets. It allows for interactively highlighting and annotating parts of text.
99

1010
![Screenshot](https://raw.githubusercontent.com/philenius/ngx-annotate-text/main/screenshot.png)
1111

1212
## Features
1313

14-
- :point_up_2: Interactively mark entities such as cities, numbers, dates, etc.
15-
- :wastebasket: Interactively remove annotations / marked entities.
16-
- :tada: Purely based on CSS. No magic, no canvas, and no SVGs.
14+
- 👆 Interactively mark text ranges such as sentences, words, or parts of words.
15+
- 🗑️ Easily remove existing annotations.
16+
- 🎉 Purely based on CSS, with no use of SVGs or canvas.
17+
- 🛠️ Customize annotation rendering with your own Angular components.
1718

1819
## Demo
1920

@@ -100,12 +101,13 @@ View and edit the live demo Angular app on <a href="https://codesandbox.io/s/ngx
100101

101102
### Inputs
102103

103-
| Input | Description | Type | Default value |
104-
| :-------------- | ------------------------------------------------------------ | ------------------ | :------------ |
105-
| annotations | Represents the parts of the given text which shall be annotated. | `Annotation[]` | `[]` |
106-
| annotationClass | An optional CSS class applied to all elements which wrap the annotated parts of the given text. | `string|undefined` | `undefined` |
107-
| removable | Determines whether annotations shall have a small button in the top right corner so that the user can remove an annotation. | `boolean` | `true` |
108-
| text | The text which shall be displayed and annotated. | `string` | empty string |
104+
| Input | Description | Type | Default value |
105+
| :------------------------ | ------------------------------------------------------------ | ------------------ | :------------ |
106+
| annotations | Represents the parts of the given text which shall be annotated. | `Annotation[]` | `[]` |
107+
| annotationClass | An optional CSS class applied to all elements which wrap the annotated parts of the given text. | `string|undefined` | `undefined` |
108+
| annotationRenderComponent | An optional Angular component that shall be used for rendering the annotation. By default, it uses the provided `NgxAnnotationRendererComponent`. You can implement your own annotation rendering component to customize the visualization of annotations. The custom component must implement the interface `NgxAnnotationRendererComponentInterface`. | `NgxAnnotationRendererComponentInterface` | `NgxAnnotationRendererComponent` |
109+
| removable | Determines whether annotations shall have a small button in the top right corner so that the user can remove an annotation. | `boolean` | `true` |
110+
| text | The text which shall be displayed and annotated. | `string` | empty string |
109111

110112
### Outputs
111113

@@ -127,7 +129,7 @@ View and edit the live demo Angular app on <a href="https://codesandbox.io/s/ngx
127129
### Recreate project from scratch
128130

129131
```bash
130-
npm install -g @angular/cli@^16
132+
npm install -g @angular/cli@^17
131133
ng new ngx-annotate-text-workspace
132134
cd ngx-annotate-text-workspace/
133135
ng generate library ngx-annotate-text

projects/ngx-annotate-text/src/lib/components/ngx-annotate-text/ngx-annotate-text.component.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ export class NgxAnnotateTextComponent implements OnInit, OnChanges {
2828
/** An optional CSS class applied to all elements which wrap the annotated parts of the given text. */
2929
@Input() annotationClass?: string;
3030

31-
/** An optional Angular component that shall be used for rendering the annotation. Must implement the interface NgxAnnotationRendererComponentInterface. */
31+
/**
32+
* An optional Angular component that shall be used for rendering the annotation. By default, it uses the provided `NgxAnnotationRendererComponent`.
33+
* You can implement your own annotation rendering component to customize the visualization of annotations. The custom component must implement the
34+
* interface `NgxAnnotationRendererComponentInterface`.
35+
*/
3236
@Input() annotationRenderComponent: Type<NgxAnnotationRendererComponentInterface> = NgxAnnotationRendererComponent;
3337

3438
/**
@@ -86,10 +90,7 @@ export class NgxAnnotateTextComponent implements OnInit, OnChanges {
8690
return undefined;
8791
}
8892

89-
return {
90-
startIndex: this.selectionStart,
91-
endIndex: this.selectionEnd,
92-
};
93+
return { startIndex: this.selectionStart, endIndex: this.selectionEnd };
9394
}
9495

9596
/**

0 commit comments

Comments
 (0)