feature: wrap converted markdown in an html-from-markdown class

This commit is contained in:
Andy Burke 2025-09-11 11:32:58 -07:00
parent 55f45b4e5b
commit 604090d8b8
4 changed files with 17 additions and 9 deletions

View file

@ -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 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. 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 #### NOTE ON WINDOWS
Because Windows has more restrictions on filenames, you can use `___` in place of `:` in Because Windows has more restrictions on filenames, you can use `___` in place of `:` in
parameter directories. parameter directories.
<TODO: examples> ### 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

View file

@ -1,7 +1,7 @@
{ {
"name": "@andyburke/serverus", "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.", "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", "license": "MIT",
"exports": { "exports": {
".": "./serverus.ts", ".": "./serverus.ts",

View file

@ -402,5 +402,5 @@ export function md_to_html(
} }
} }
return html; return `<div class="html-from-markdown">${html}</div>`;
} }

View file

@ -166,7 +166,7 @@ Deno.test({
<body> <body>
<p>Hello. Markdown should follow:</p> <p>Hello. Markdown should follow:</p>
<h1>This is Markdown</h1> <div class="html-from-markdown"><h1>This is Markdown</h1>
<br> <br>
Welcome to it. Welcome to it.
<br> <br>
@ -197,7 +197,7 @@ Can you read this?
<h2>Ok, that seems sufficient?</h2> <h2>Ok, that seems sufficient?</h2>
<br> <br>
Hardly, but we&#39;ll get back to this. Hardly, but we&#39;ll get back to this.
</div>
Just some random text in a random text file. Just some random text in a random text file.
<div>Include #1</div> <div>Include #1</div>