From 604090d8b8ee2883d61a75c8ef50c525f1f21d7e Mon Sep 17 00:00:00 2001 From: Andy Burke Date: Thu, 11 Sep 2025 11:32:58 -0700 Subject: [PATCH] feature: wrap converted markdown in an `html-from-markdown` class --- README.md | 18 +++++++++++++----- deno.json | 2 +- handlers/markdown.ts | 2 +- tests/08_test_html_includes.test.ts | 4 ++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7daf6e2..544fb6e 100644 --- a/README.md +++ b/README.md @@ -110,13 +110,21 @@ object indicating permission is denied or similar. Any `_pre.ts` files found under the root that export `.load()` and/or `.unload()` methods will be loaded and those functions will be called at server startup/shutdown, respectively. -## TODO - - - [ ] reload typescript if it is modified on disk - #### NOTE ON WINDOWS Because Windows has more restrictions on filenames, you can use `___` in place of `:` in parameter directories. - +### Examples + +TODO: write me + +## TODO + - [ ] write examples above + - [ ] reload typescript if it is modified on disk + - [X] wrap markdown converted to html in a div with a class for styling + +## CHANGELOG + + - 0.13.0 + - wrap converted markdown in an `html-from-markdown` class diff --git a/deno.json b/deno.json index a4e3e23..3be3a87 100644 --- a/deno.json +++ b/deno.json @@ -1,7 +1,7 @@ { "name": "@andyburke/serverus", "description": "A flexible HTTP server for mixed content. Throw static files, markdown, Typescript and (hopefully, eventually) more into a directory and serverus can serve it up a bit more like old-school CGI.", - "version": "0.12.5", + "version": "0.13.0", "license": "MIT", "exports": { ".": "./serverus.ts", diff --git a/handlers/markdown.ts b/handlers/markdown.ts index 913e639..aec3cb6 100644 --- a/handlers/markdown.ts +++ b/handlers/markdown.ts @@ -402,5 +402,5 @@ export function md_to_html( } } - return html; + return `
${html}
`; } diff --git a/tests/08_test_html_includes.test.ts b/tests/08_test_html_includes.test.ts index 40dcb39..501cf96 100644 --- a/tests/08_test_html_includes.test.ts +++ b/tests/08_test_html_includes.test.ts @@ -166,7 +166,7 @@ Deno.test({

Hello. Markdown should follow:

-

This is Markdown

+

This is Markdown


Welcome to it.
@@ -197,7 +197,7 @@ Can you read this?

Ok, that seems sufficient?


Hardly, but we'll get back to this. - +
Just some random text in a random text file.
Include #1