You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,18 @@
3
3
4
4
# ngx-remark
5
5
6
-
**ngx-remark** is a library that allows to render Markdown with custom Angular components and templates.
6
+
**ngx-remark** is a lightweight library that renders Markdown using **native Angular components and templates**.
7
7
8
-
Most libraries for rendering Markdown in Angular first transform the Markdown to HTML and then use the `innerHTML` attribute to render the HTML. The problem of this approach is that there is no way to use Angular components or directives in any part of the generated HTML.
8
+
Most Markdown libraries for Angular convert the source to HTML and then bind it with `[innerHTML]`. The problem with this approach is that the resulting HTML lives outside Angular's component tree — you cannot use Angular components, directives, pipes, or dependency injection inside it.
9
9
10
-
In contrast, this library uses [Remark](https://remark.js.org/) to parse the Markdown into an abstract syntax tree (AST) and then uses Angular to render the AST as HTML. The `<remark>` component renders all standard Markdown elements with default built-in templates, but it also allows to override the templates for any element.
10
+
**ngx-remark** takes a different route. It uses [Remark](https://remark.js.org/) to parse Markdown into an AST, then renders that tree with real Angular templates. The `<remark>` component ships with clean default templates for every standard Markdown element, but **you can override any of them** with your own components.
11
11
12
12
Typical use cases include:
13
13
14
-
-Displaying code blocks with a custom code editor.
15
-
-Displaying custom tooltips over certain elements.
16
-
-Allowing custom actions with buttons or links.
17
-
-Integration with Angular features, like the [`Router`](#router-integration).
14
+
-Rendering code blocks with a full-featured editor (e.g. Monaco, CodeMirror)
15
+
-Adding interactive tooltips, popovers, or badges on specific elements
16
+
-Turning links or buttons into Angular-powered actions (routing, modals, etc.)
17
+
-Deep integration with Angular features like the [`Router`](#router-integration), forms, or signals
18
18
19
19
## Demo
20
20
@@ -32,7 +32,7 @@ npm install ngx-remark remark
32
32
33
33
## Importing the library
34
34
35
-
Import the `RemarkModule` in your standalone component or module:
35
+
Import `RemarkModule` in your standalone component or module:
36
36
37
37
```typescript
38
38
import { RemarkModule } from'ngx-remark';
@@ -45,6 +45,8 @@ import { RemarkModule } from 'ngx-remark';
45
45
exportclassApp { }
46
46
```
47
47
48
+
Note: `RemarkModule` is a bundle of `RemarkComponent`, `RemarkNodeComponent` and `RemarkTemplateDirective`. You may also import these components individually, but in most cases you will need the three of them together.
0 commit comments