Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@ng-util/markdown

ng-util1.5kMIT20.0.1TypeScript support: included

Vditor for Angular

angular, util, Angular utilities, markdown, Vditor, angular standalone library

readme

@ng-util/markdown

Vditor for Angular.

NPM version Build Status codecov Dependency Status prettier GitHub license

Demo

Usage

Installation

Install from npm repository:

npm install @ng-util/markdown --save

Simple

Standalone

import { Component } from '@angular/core';
import { NuMonacoEditorComponent } from '@ng-util/monaco-editor';

@Component({
  selector: 'demo',
  template: `
    <nu-monaco-editor />
  `,
  imports: [NuMonacoEditorComponent],
})
export class MonacoDemo { }

Module

Include NuMarkdownModule in Main Module and Feature Modules where you want to use the editor component.(eg: app.module.ts):

import { NgModule } from '@angular/core';
import { NuMarkdownModule } from '@ng-util/markdown';

@NgModule({
  imports: [
    NuMarkdownModule // And use `provideNuMarkdownConfig` to modify the global configuration
  ],
})
export class AppModule { }

Create markdown options in component.

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `<nu-markdown [(ngModel)]="value"></nu-markdown>`,
})
export class DemoComponent {
  value = '# Title';
}

Preview

You can use nu-markdown-preview component to render a Markdown preview effect (no editing).

<nu-markdown-preview value="# Title"></nu-markdown-preview>

How to change cdn?

  • If using standalone use provideNuMarkdownConfig({ libs: [] }) to adjust.
  • If using module, use NuMarkdownModule.forRoot({ libs: [] }) to adjust.

The libs parameter should contain index.min.js and index.css, like this:

provideNuMarkdownConfig({ 
  libs: [
    'https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js',
    'https://cdn.jsdelivr.net/npm/vditor/dist/index.css'
  ]
})

In addition, You can also use local path:

// angular.json
{
  "glob": "*.(js|css)",
  "input": "node_modules/vditor/dist",
  "output": "/assets/vditor/"
}

Then modify the libs path:

provideNuMarkdownConfig({ 
  libs: [
    './assets/vditor/index.min.js',
    './assets/vditor/index.css'
  ]
})

API

nu-markdown

Property Description Type Default
[options] Equar IOptions any -
[disabled] Disabled of markdown editor boolean false
[delay] Delay init monaco editor, unit: ms number 0
(ready) Ready event EventEmitter<any> -

nu-markdown-preview

Property Description Type Default
[options] Equar IOptions any -
[delay] Delay init monaco editor, unit: ms number 0
(ready) Ready event EventEmitter<string> -

License

The MIT License (see the LICENSE file for the full text)

changelog

20.0.1 (2025-06-24)

  • fix(monaco-editor): fix can't auto format when ngModel changed (#92) (b6c0d34), closes #92

20.0.0 (2025-06-07)

  • refactor: using signal (#90) (d431ce0), closes #90
  • fix(monaco-editor): fix missing monaco types (#84) (9c28df0), closes #84

19.0.1 (2025-01-27)

  • fix(monaco-editor): fix missing monaco types (#84) (9c28df0), closes #84

19.0.0 (2024-11-23)

  • build: bump to angular 19 (#81) (7e6412d), closes #81

18.1.0 (2024-11-02)

  • feat(monaco-editor): add placeholder (#79) (8206f10), closes #79

18.0.0 (2024-06-15)

  • build: bump angular 18 (#77) (72fa40e), closes #77

17.0.1 (2023-11-11)

17.0.0 (2023-11-09)

Bug Fixes

  • monaco-editor: correct automatic formatting (#68) (0e0b29f)

16.0.1 (2023-10-21)

Bug Fixes

  • monaco-editor: correct automatic formatting (#68) (0e0b29f)

16.0.0 (2023-06-04)

  • build: bump angular to 16

15.0.0 (2023-01-02)

  • build: bump angular to 15

14.0.1 (2022-09-29)

Bug Fixes

  • markdown: add options to preview (#60) (e7c569b)

14.0.0 (2022-06-24)

13.1.0 (2022-06-03)

Features

  • monaco-editor: add autoFormat property (#53) (3876252)

13.0.0 (2021-12-28)

12.1.2 (2021-12-20)

Bug Fixes

12.1.1 (2021-08-02)

Bug Fixes

  • should be close ivy of npm package (#43) (9d15111)

12.1.0 (2021-08-02)

Bug Fixes

Features

  • module:lazy: allow to specify resource type (#32) (86c6cb5)
  • module:monaco: add monacoPreLoad Config (#40) (ab2396b)

12.0.0 (2021-05-27)

Bug Fixes

Features

  • module:lazy: allow to specify resource type (#32) (86c6cb5)

11.2.0 (2021-03-01)

Bug Fixes

Features

  • module:lazy: allow to specify resource type (#32) (86c6cb5)

11.1.1 (2020-12-25)

Bug Fixes

11.1.0 (2020-11-13)

Features

  • module:markdown: add nu-markdown-preview component (#26) (6affc7a)

11.0.0 (2020-11-13)

Just bump angular version from 10 to 11.

10.2.2 (2020-07-21)

10.2.0 (2020-07-13)

Bug Fixes

  • module:markdown: fix unable to load again (#18) (e898683)

Features

  • module:lazy: use monitor instead change (#19) (bbf1135)

10.1.1 (2020-07-11)

Bug Fixes

  • module:markdown: fix missing dependencies (#15) (a0b3bf0)

10.1.0 (2020-07-11)

Features

10.0.0 (2020-06-28)

  • Just flash a version number

9.2.0 (2020-06-11)

Features

  • monaco-editor: add delay property (#8) (8857396)
  • add util libary (#9) (b1a6772)
  • monaco-editor: add monaco-editor libary (#6) (7bae472)

9.1.0 (2020-05-12)

Features

  • monaco-editor: add monaco-editor libary (#6) (7bae472)

9.0.0 (2020-05-10)