Skip to main content

No project description provided

Project description

mdnet

mdnet is a simple static site generator that converts Markdown files into HTML using specified templates. It's designed to be lightweight and easy to use.

Features

  • HTML generation
  • RSS Feed generation
  • Post metadata via YAML Frontmatter
  • Configurable via YAML

Installation

You can install mdnet via pip:

pip install mdnet

Usage

Basic Command

To generate a static site using the default configurations specified in config.yaml:

mdnet

Command-Line Arguments

You can override the default configurations using command-line arguments:

  • input_dir: Directory containing the Markdown source files.
  • output_dir: Destination directory for the generated HTML files.
  • post_template_path: Path to the HTML template for individual posts.
  • index_template_path: Path to the HTML template for the main index page.

For example:

mdnet custom_input custom_output custom_post_template.html custom_index_template.html

Optional Arguments

  • -t, --tag_template_path: Path to the HTML template for individual tag pages. If provided, tag pages will be generated.
  • -a, --all_tags_template_path: Path to the HTML template for the page listing all tags.
  • -n, --num_posts: Number of latest posts to display on the main index page. Defaults to 8.
  • -p, --all_posts_template_path: Path to the HTML template for the page listing all posts.

Configuration

You can specify default configurations in a config.yaml file. This allows you to run mdnet without having to provide command-line arguments every time.

Example config.yaml:

input_dir: "posts/"
output_dir: "public/"
post_template_path: "templates/post.html"
index_template_path: "templates/index.html"
tag_template_path: "templates/tag.html"
all_tags_template_path: "templates/all_tags.html"
all_posts_template_path: "templates/all_posts.html"
num_posts: 8
rss: true # IF TRUE ALL POSTS MUST HAVE YAML FRONTMATTER
site_title: "My Test Blog"
site_url: "https://mytestblog.com/"
site_description: "The Writings of Me"
timezone: America/Los_Angeles

Frontmatter YAML Parameters

When writing your Markdown files, you can optionally include a frontmatter section at the beginning of each file. This section is written in YAML and allows you to specify metadata for each post. Here are the supported parameters:

  • title: The title of the post. If not provided, the filename (without extension) will be used.
    • Format: String
  • date: The publication date of the post. If not provided, posts without dates will be considered older.
    • Format: YYYY-MM-DD
  • tldr: A short summary or "too long; didn't read" for the post.
    • Format: String
  • tags: A list of tags associated with the post.
    • Format: List of strings

Example Frontmatter

---
title: "My First Post"
date: 2023-07-27
tldr: "A brief summary of the post's content."
tags:
  - tutorial
  - markdown
---

Example Project Structure

my_project/
│
├── posts/
│   ├── post1.md
│   ├── post2.md
│   └── ...
│
├── public/
│   ├── index.html
│   ├── css/
│   │   └── style.css
│   ├── posts/
│   │   ├── index.html
│   │   ├── post1.html
│   │   ├── post2.html
│   │   └── ...
│   ├── resources/
│   │   └── rss.xml
│   └── tags/
│       ├── index.html
│       ├── tutorial.html
│       ├── markdown.html
│       └── ...
│
├── templates/
│   ├── post_template.html
│   ├── index_template.html
│   ├── tag_template.html
│   ├── all_tags_template.html
│   └── all_posts_template.html
│
├── resources/
│   └── guids.json
│
└── config.yaml

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

mdnet-0.1.9.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

mdnet-0.1.9-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file mdnet-0.1.9.tar.gz.

File metadata

  • Download URL: mdnet-0.1.9.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for mdnet-0.1.9.tar.gz
Algorithm Hash digest
SHA256 2ba2cfc1cbcaf6928b33cbe002d88c14828eb7b5cdf45e7d1f0d6cbed6c867b6
MD5 cc874dd5c95eb8094b11b0743d0b19eb
BLAKE2b-256 7299ce374df13847e45cb4ad476ae07c11813303c2111c574787fa7d134179ca

See more details on using hashes here.

File details

Details for the file mdnet-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: mdnet-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for mdnet-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f6dcaec4bc9e3f09ba6fc91778350499ad7ddb677df60a95d854ca2a86b8adc5
MD5 da49bc044623068d0806a6b2ab56ae2e
BLAKE2b-256 9cfd4d3aa924d98e4502cf84b007eabf47a6bd4d2008d92f1957d8088e185eb7

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