a markdown-based webserver built with rust and estrogen
| debian | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| config.toml | ||
| LICENSE.md | ||
| readme.md | ||
Markdown Webserver
The name is... pending
This is a webserver written in rust that provides several neat features:
- a meager level of dynamic content without any javascript
- a formatted
curloutput - structured predominantly with markdown
visit my website to see it in action
Usage
For a basic overview- basic server settings are configured in a config.toml file, which is searched for in two places: ~/.config/mdws/config.toml, then in /etc/mdws/config.toml. If it can't be found in either location, it uses the defaults below:
server_root = "/srv/mdws/root"
listen_port = 3030
bind_address = [127, 0, 0, 1]
server_domain = "127.0.0.1:3030"
- every directory under
server_rootwith the exception of/assetscan be browsed, and will render any markdown files within it as 'markdown modules'.- content under /assets will be served as-is, making it a suitable place to store styling, images, templates, etc.
- any browsable directory containing markdown files will be displayed in the sitemap in the sidebar, unless it contains a
.secretfile, in which case it will be hidden from the sidebar but can be manually linked or navigated to. - the sidebar is generated from
.mdfiles located in/assets/sidebar.- The dynamic image modules are semi-hard-coded (firm-coded?) at the moment, and I have plans to make that more malleable.
- The sitemap is intentionally hard-coded, but will not be displayed unless there is a
sitemap.mdsidebar module that contains${sitemap}somewhere in it.- note that the basename of
server_rootwill be revealed in the sitemap- it uses the actual name of the directory on-disk
- note that the basename of
- you should place a
page.htmlat/assets/templates- this file is the skeleton of every page- it needs the following placeholders to determine where site content will be injected:
${header}: a single<div>with a class and id ofheaderin which the contents ofheader.mdwill be rendered${sidebar}: a collection<div>s, each with a class ofmarkdown-moduleand an id of the markdown file's stem (basename without extension).- these markdown modules come from
<server_root>/assets/sidebar
- these markdown modules come from
${content}: a collection<div>s, each with a class ofmarkdown-moduleand an id of the markdown file's stem (basename without extension).- these markdown modules come from
<server_root>with the request path appended to the end
- these markdown modules come from
- this file is the skeleton of every page- it needs the following placeholders to determine where site content will be injected:
- i totally forgot to implement a footer, woops
- if a request leads to an invalid or nonexistent location, it is redirect to the server's root page
todo:
-
rss feeds
-
implement all client-side js modules from https://pogmom.me (i'm draining brendan of his life force so i can save the world from him)
-
generate sitemap in sidebar
-
detect if markdown module has associated directory (by file basename, maybe specified in frontmatter?)
-
so much more