Make it modern

This commit is contained in:
Fabian Stamm
2023-11-28 16:10:33 +01:00
parent 22a447604b
commit a14a5b9462
35 changed files with 656 additions and 200 deletions

View File

@ -1,6 +1,6 @@
{
"name": "markdown",
"version": "0.0.1",
"version": "0.1.0",
"description": "",
"author": "Fabian Stamm <dev@fabianstamm.de>",
"contributors": [],
@ -9,4 +9,4 @@
"**/*.js",
"README.md"
]
}
}

View File

@ -22,7 +22,9 @@ import {
Obj
} from "./interfaces.ts";
import { Marked } from "./marked.ts";
import { load } from "https://deno.land/std/encoding/_yaml/loader/loader.ts";
import { parse } from "https://deno.land/std@0.208.0/yaml/mod.ts";
export class BlockLexer<T extends typeof BlockLexer> {
static simpleRules: RegExp[] = [];
@ -300,7 +302,7 @@ export class BlockLexer<T extends typeof BlockLexer> {
// Grabs front-matter data and parse it into Javascript object.
if (fmArr = /^(?:\-\-\-)(.*?)(?:\-\-\-|\.\.\.)/s.exec(nextPart)) {
nextPart = nextPart.substring(fmArr[0].length);
this.frontmatter = <Obj> load(fmArr[1]);
this.frontmatter = <Obj>parse(fmArr[1]);
}
continue;
@ -510,7 +512,7 @@ export class BlockLexer<T extends typeof BlockLexer> {
if (nextPart) {
throw new Error(
"Infinite loop on byte: " + nextPart.charCodeAt(0) +
`, near text '${nextPart.slice(0, 30)}...'`,
`, near text '${nextPart.slice(0, 30)}...'`,
);
}
}