Moving to 'marked' for markdown parsing; added reference dependencies for future consideration

This commit is contained in:
2025-10-07 19:29:55 -05:00
parent ed89f34d40
commit f94a8ca26c
3 changed files with 9 additions and 3 deletions

View File

@@ -6,6 +6,8 @@ import {
} from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { marked } from 'marked';
import { MarkdownPreviewService } from '../../common/services/editor/markdown-preview/markdown-preview.service';
import { ServiceMessage } from '../../common/types/service-message.type';
@@ -29,7 +31,7 @@ export class MarkdownPreviewComponent {
private markdownPreviewService: MarkdownPreviewService = inject(MarkdownPreviewService);
@HostBinding("class.hidden") isHidden: boolean = true;
converter: any = new showdown.Converter();
converter: any = marked;
defaultHtml: string = "<h1>NOT a Markdown file...</h1>"
bodyHtml: string = "";
@@ -85,7 +87,7 @@ export class MarkdownPreviewComponent {
let mdStr = this.editorComponent.editor.session.getValue();
let pathParts = this.editorComponent.activeFile.path.split("/");
let basePath = "file://" + pathParts.slice(0, -1).join("/");
this.bodyHtml = this.converter.makeHtml(
this.bodyHtml = this.converter.parse(
mdStr.replaceAll("](images", `](${basePath}/images`)
.replaceAll("](imgs", `](${basePath}/imgs`)
.replaceAll("](pictures", `](${basePath}/pictures`)

2
src/typings.d.ts vendored
View File

@@ -1 +1 @@
declare var showdown: any;
// declare var showdown: any;