workdown
workdown copied to clipboard
Convert a markdown file to a page hosted by CF Workers
Workdown
A system to write Markdown and have it published and hosted via Cloudflare Workers
Pre-requisites
- Python 3
- Install
wrangler
Usage
- Run
pip3 install workdown - Run
wrangler configand configure with your Cloudflare credentials - Run
wrangler generate --type="javascript" site https://github.com/eldridgea/workdown-example-site. This will generate a folder calledsitecontaining the folder structureworkdownrequires to work. - Configure
wrangler.tomlwith your Cloudflare details and haveworkers_dev = false. - Make sure your route ends in a wildcard e.g.
route = "https://example.com/*" - Run
wrangler kv:namespace create pagesandwrangler kv:namespace create cssand paste the bindings into yourwrangler.toml. - Edit
content/index.mdfile. - From the
sitefolder (or whatever you named it) runworkdown - Done!
CSS
CSS should go in the css/ directory. They will be available as their full filename under css. For example if you make main.css, it will be example.com/css/main.css
Partials
Here is where you can customize the header and footer of pages in HTML. Currently all partials apply to all pages generated. Good things to do here would be if you have a static CSS file in css/ or would like to include a a fonts CDN, add it into the <head> in the partials/header.html so it will be usable on your pages.
Notes
The path for content will be the name of the markdown file with no extension. For example if you make contact.md, it will be example.com/contact.
Also, Workers only work on (sub)domains proxied by Cloudflare. So make sure you have your domain that you used in your wrangler.toml path proxied.
Alternative Instalattion Methods
Install directly from Github
pip3 install git+https://github.com/eldridgea/workdown
Manual Install
git clone https://github.com/eldridgea/workdowncd workdownpython3 setup.py install