diff --git a/par/md.test.ts b/par/md.test.ts index 436708b..57af2b9 100644 --- a/par/md.test.ts +++ b/par/md.test.ts @@ -21,3 +21,26 @@ Deno.test({ assertEquals(ren.render(res), "

hello

"); }, }); + +Deno.test({ + name: "should parse header with specific level", + fn: () => { + const par = new MarkdownParser(); + assertEquals(ren.render(par.parse("# hello")), "

hello

"); + assertEquals(ren.render(par.parse("## hello")), "

hello

"); + assertEquals(ren.render(par.parse("### hello")), "

hello

"); + assertEquals(ren.render(par.parse("#### hello")), "

hello

"); + assertEquals(ren.render(par.parse("##### hello")), "
hello
"); + assertEquals(ren.render(par.parse("###### hello")), "
hello
"); + }, +}); + +Deno.test({ + name: "should parse header if line contains additional spaces", + fn: () => { + const par = new MarkdownParser(); + assertEquals(ren.render(par.parse(" # hello")), "

hello

"); + assertEquals(ren.render(par.parse(" # hello")), "

hello

"); + assertEquals(ren.render(par.parse(" # hello")), "

hello

"); + }, +});