I use remark to convert markdown to html and I got error
remark works with nodejs
I don't know either angular or remark goes wrong
Pleas help
here is error code
ERROR ReferenceError: process is not defined
at new VFile (core.js:55)
at VFile (core.js:49)
at Function.processSync (index.js:387)
at AppComponent.ngOnInit (app.component.ts:21)
at checkAndUpdateDirectiveInline (core.js:31909)
at checkAndUpdateNodeInline (core.js:44366)
at checkAndUpdateNode (core.js:44305)
at debugCheckAndUpdateNode (core.js:45327)
at debugCheckDirectivesFn (core.js:45270)
at Object.eval [as updateDirectives] (AppComponent_Host.ngfactory.js? [sm]:1)
here is app.component.ts
import { Component, OnInit } from '@angular/core';
import * as remark from 'remark';
import * as html from 'remark-html';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
htmlDoc: string;
mdDoc: string;
constructor() { }
ngOnInit() {
console.log(
remark()
.use(html)
.processSync('# hello World').toString()
);
}
}