style: fix linting issues met Prettier
This commit is contained in:
parent
aa1a85e64e
commit
2a2881ec30
84 changed files with 846 additions and 1013 deletions
|
@ -2,12 +2,12 @@
|
|||
* Based on https://github.com/dwengovzw/Learning-Object-Repository/blob/main/app/processors/markdown/markdown_processor.js
|
||||
*/
|
||||
|
||||
import {marked} from 'marked';
|
||||
import { marked } from 'marked';
|
||||
import InlineImageProcessor from '../image/inline-image-processor.js';
|
||||
import {DwengoContentType} from "../content-type";
|
||||
import dwengoMarkedRenderer from "./dwengo-marked-renderer";
|
||||
import {StringProcessor} from "../string-processor";
|
||||
import {ProcessingError} from "../processing-error";
|
||||
import { DwengoContentType } from '../content-type';
|
||||
import dwengoMarkedRenderer from './dwengo-marked-renderer';
|
||||
import { StringProcessor } from '../string-processor';
|
||||
import { ProcessingError } from '../processing-error';
|
||||
|
||||
class MarkdownProcessor extends StringProcessor {
|
||||
constructor() {
|
||||
|
@ -15,10 +15,10 @@ class MarkdownProcessor extends StringProcessor {
|
|||
}
|
||||
|
||||
override renderFn(mdText: string) {
|
||||
let html = "";
|
||||
let html = '';
|
||||
try {
|
||||
marked.use({renderer: dwengoMarkedRenderer});
|
||||
html = marked(mdText, {async: false});
|
||||
marked.use({ renderer: dwengoMarkedRenderer });
|
||||
html = marked(mdText, { async: false });
|
||||
html = this.replaceLinks(html); // Replace html image links path
|
||||
} catch (e: any) {
|
||||
throw new ProcessingError(e.message);
|
||||
|
@ -28,14 +28,10 @@ class MarkdownProcessor extends StringProcessor {
|
|||
|
||||
replaceLinks(html: string) {
|
||||
const proc = new InlineImageProcessor();
|
||||
html = html.replace(/<img.*?src="(.*?)".*?(alt="(.*?)")?.*?(title="(.*?)")?.*?>/g, (
|
||||
match: string,
|
||||
src: string,
|
||||
alt: string,
|
||||
altText: string,
|
||||
title: string,
|
||||
titleText: string
|
||||
) => proc.render(src));
|
||||
html = html.replace(
|
||||
/<img.*?src="(.*?)".*?(alt="(.*?)")?.*?(title="(.*?)")?.*?>/g,
|
||||
(match: string, src: string, alt: string, altText: string, title: string, titleText: string) => proc.render(src)
|
||||
);
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue