Skip to content

Commit

Permalink
docs: update document
Browse files Browse the repository at this point in the history
- close #75
  • Loading branch information
cipchk committed Jan 26, 2024
1 parent f8fefc1 commit 403c4da
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 5 deletions.
6 changes: 2 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
},
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
// For ESLint
"source.fixAll.eslint": true,
// For Stylelint
"source.fixAll.stylelint": true,
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
},
"[markdown]": {
"editor.formatOnSave": false
Expand Down
59 changes: 58 additions & 1 deletion packages/markdown/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,26 @@ Install from npm repository:
npm install @ng-util/markdown --save
```

### Sample
### Simple

**Standalone**

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

@Component({
selector: 'demo',
template: `
<nu-monaco-editor />
`,
standalone: true,
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):

Expand Down Expand Up @@ -62,6 +81,44 @@ You can use `nu-markdown-preview` component to render a Markdown preview effect
<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:

```ts
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:

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

Then modify the libs path:

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

## API

### nu-markdown
Expand Down

0 comments on commit 403c4da

Please sign in to comment.