123456789101112131415161718192021222324252627282930313233343536 |
- import { Component, OnInit, OnDestroy } from '@angular/core';
- import { Editor } from 'ngx-editor';
- import { marked } from 'marked';
- @Component({
- selector: 'app-journal-notes',
- templateUrl: './journal-notes.component.html',
- styleUrl: './journal-notes.component.scss',
- })
- export class JournalNotesComponent implements OnInit, OnDestroy {
- editor: Editor = new Editor();
- html = '';
- markdownString =
- ' # Hello \n \
- this is a test \
- **hi** \
- \
- - 1\
- - 2';
- htmlString = '';
- constructor() {
- this.htmlString = marked(this.markdownString);
- console.log(this.markdownString);
- console.log(this.htmlString);
- }
- ngOnInit(): void {}
- // make sure to destory the editor
- ngOnDestroy(): void {
- this.editor.destroy();
- }
- }
|