mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 14:12:55 +00:00 
			
		
		
		
	Create Markdown service
This commit is contained in:
		
							
								
								
									
										15
									
								
								src/app/markdown.service.spec.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/app/markdown.service.spec.ts
									
									
									
									
									
										Normal 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();
 | 
			
		||||
  }));
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										14
									
								
								src/app/markdown.service.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/app/markdown.service.ts
									
									
									
									
									
										Normal 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);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user