Create Markdown service

This commit is contained in:
Bálint Bokros 2017-12-18 17:49:57 +01:00
parent 154c6c8fef
commit f14be39faf
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';
import { MarkdownService } from './markdown.service';
describe('MarkdownService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [MarkdownService]
});
});
it('should be created', inject([MarkdownService], (service: MarkdownService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -0,0 +1,14 @@
import { Injectable } from '@angular/core';
import { Converter } from 'showdown';
@Injectable()
export class MarkdownService {
private converter: Converter;
constructor() {
this.converter = new Converter();
}
convertToHtml(text: string) {
return this.converter.makeHtml(text);
}
}