@notiz/ngx-markdoc
npm i @notiz/ngx-markdoc @markdoc/markdoc js-yaml
npm i -D @types/react @types/markdown-it @types/js-yaml
Set allowSyntheticDefaultImports
to true
in your tsconfig.json
.
Usage
Import Markdoc
into your component module
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DocsRoutingModule } from './docs-routing.module';
import { DocsComponent } from './docs.component';
import { Markdoc } from '@notiz/ngx-markdoc';
@NgModule({
declarations: [DocsComponent],
imports: [CommonModule, DocsRoutingModule, Markdoc],
})
export class DocsModule {}
Use the <markdoc></markdoc>
component in your template. Provide Markdown content in one of the following ways.
1. Content
<markdoc> # Markdoc for Angular </markdoc>
2. Content input
<markdoc content="# Markdoc for Angular"> </markdoc>
3. Markdown file
<markdoc src="assets/md/example.md"></markdoc>