Skip to main content

Static website generator

Project description

MDiocre

MDiocre

A very simple static website generator tool powered by Python. It primarily converts Markdown files and combines it with an HTML template, but can be extended to other markup.

Requirements

  • Python 3 (python-markdown + py-gfm)

Other Requirements

ReStructuredText (RST) support requires docutils to be installed.

If you want to build the documentation, you will have to install Sphinx as well.

What sets it apart from other tools?

It's terrible and it doesn't have a profitable and pragmatic usecase in mind, but it works okay. For my needs, anyway. It's alright for simple blogs with no tagging and very simple static websites.

How do I make a site with this?

  1. Install mdiocre by using the command: python3 -m pip install mdiocre.

  2. Create a work folder. Let's call it work.

  3. Make a file called template.html inside that folder with these contents:

    <html>
    <head>Welcome to my website!</head>
    <body><!--:content--></body>
    </html>
    
  4. Create a folder called src, and make a file inside of it called index.md, and write anything on it.

  5. After your content (or before, it doesn't matter), add: <!--:mdiocre-template="../template.html"-->

  6. Go back a level to your work folder. Assuming Python is present in your PATH (environment variable), create a new text document containing:

    python3 -m mdiocre.interface.cli src build
    

    Save it inside the folder as a .bat if you're on Windows, or as a .sh if you're on Mac, Linux, or other Unix-like systems. Double click or execute it.

  7. Check the build folder.

Variables

MDiocre allows setting variables. These variables are per-page, and can be read by the template. Both the template and the markdown page share the same format for templates - which are HTML comments with the first character after the markup being the colon (:)

Setting a variable to a string

<!--: hello = "test message" -->

Simply sets hello to test message. When using a comma, make sure to escape it with \!

Setting a variable to another variable

<!--: hello = lemons -->

If lemons is 1 then hello will also be 1. If lemons is not set, hello will contain the string lemons.

Concatenating two or more variables

<!--: lemons = hello, hello -->

If hello contains abc then lemons will contain abcabc. However, if you also include a space string in between, like this...

<!-- lemons = hello, " ", hello -->

lemons will contain abc abc!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdiocre-3.3.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdiocre-3.3-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file mdiocre-3.3.tar.gz.

File metadata

  • Download URL: mdiocre-3.3.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for mdiocre-3.3.tar.gz
Algorithm Hash digest
SHA256 edeff8aa0aa2bc2278a2d961e6fccdf848ba2a94ffe00593cd14e2f2dd493e33
MD5 c50eb7d0a2e53c241784b3075a92ed33
BLAKE2b-256 1f48058b6c6eda0b5450aa7ba725e03fba11a7633d7d99568c5081ffbb0cdb78

See more details on using hashes here.

File details

Details for the file mdiocre-3.3-py3-none-any.whl.

File metadata

  • Download URL: mdiocre-3.3-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for mdiocre-3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ac64c1c3e8307821de16c9c3b89c323157c70f7287a923806b8ce31054164da8
MD5 b3dd040498664cfe7957df08d2fd3e95
BLAKE2b-256 6ca7f1b37f57be409c062557d35b94016ef27c89ed46bf0685520086827e437c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page