doxiaodong / ng2-simplemde

angular2 component of https://github.com/sparksuite/simplemde-markdown-editor
24 stars 21 forks source link
angular markdown ng2-simplemde simplemde

Build Status Downloads [Versions]() [License]()

simplemde-markdown-editor with Angular

demo

https://doxiaodong.github.io/ng2-simplemde

Usage

import { NgModule } from '@angular/core'
import { SimplemdeModule, SIMPLEMDE_CONFIG } from 'ng2-simplemde'
@NgModule({
  imports: [
    SimplemdeModule.forRoot({
      provide: SIMPLEMDE_CONFIG,
      // config options 1
      useValue: $options1
    })
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
<!-- config options 2 -->
<simplemde [(ngModel)]="value" [options]="$options2" [codemirror]="{ lineNumbers: true }"></simplemde>
  1. The final options is {...$options1, ...$options2}, Object.assign({}, $options1, $options2)
  2. The element option is not useful
  3. codemirror is option set for codemirror, see https://github.com/codemirror/CodeMirror

Webpack

Style

<link href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css" rel="stylesheet">