MDSite
Create a static website from Markdown sources
(c) kmb@kai-m-becker.de, 2014

MDSite is a PHP script that

  • scans a directory tree
  • converts every .md file into .html
  • leaves the sources unchanged
  • can be run locally (PHP console) or on a server

Its purpose is to support you to build small, static web sites with a focus on content, rather than layout tricks.

Contents is written in Multimarkdown, a Markdown extension from Fletcher Penny.

When the contents of a page - its .md file - has changed, MDSite must be run manually, to update the correspondent .html file. If MDSite is run locally, the updated .hmtl files must be transferred onto the web server.

MDSite is available free of charge, but a donation would be appreciated.

Requirements

  1. The MDSite Zip-package
  2. PHP 5.3 or better, installed locally or on a webserver
  3. A little knowledge in Markdown and HTML
  4. A text editor

Quick start locally

  1. Download the Zip package
  2. Unpack the zip into a new directory (either on your PC or on your server)
  3. Run mdsite once: php -f mdsite.php
  4. Inspect the .html files that have been created: http://yourserver/yourdirectory/

Quick start on a web server

  1. Download the Zip package
  2. Unpack the zip into a new directory
  3. Upload all files onto your server
  4. Ensure that PHP has the rights to create and write files in your directory.
  5. Run mdsite once: http://yourserver/yourdirectory/mdsite.php
  6. Inspect the files, that have been created: index.html

After the first run

  1. Look into the files header.inc, footer.inc and menu.inc and change them where the comments are
  2. Modify the index.md
  3. Add new .md files for more pages
  4. Run mdsite.php again to update the .html files

How does it work?

MDSite scans the complete directory tree from its own location downwards. All .md files will be converted from Markdown to HTML and written to .html files with the same name: index.md will create index.html and so on.

In addition, each file will be wrapped into header.inc and footer.inc. You should use header.inc to define styles, menus and stuff, and footer.inc for imprint and contact.

If you have additional header.inc and/or footer.inc in a subdirectory, their contents will be appended to the header/footer from the directory above. See the example.

The header may contain a label {{menu}}. This label will be replaced by the contents of the file menu.inc.

menu.inc will also be recursively appended. I.e. additional menu.inc in a subdirectory will be appended to the menu from above.

Hints

Local links

If you refer to a local page, use the .html file name. I.e. if you made a new page contact.md, use [contact](contact.html) to link to it. Use the full path, where necessary (/contact.html).

Copyright and stuff