Some utilities for managing Markdown files with metadata.
Project description
Markdown Site Utils
Some utilities for managing Markdown files with metadata.
The notion is that a content-oriented website may be written as a hierarchical series of Markdown files (with an ".md" extension) underneath some data directory, e.g.:
DATA_DIR/
index.md
foo.md
bar.md
subdir/
index.md
foo.md
bar.md
Each file may contain metadata, written in TOML in a section at the top, bounded by '+++' lines:
+++
title = "My Page Title"
+++
# Some Markdown
YAML and JSON may also be used. YAML blocks should start and end with lines consisting of three dashes; JSON blocks should consist of a single JSON object with opening and closing braces on lines by themselves. The data block is optional but if present must begin on the first line of the file.
To use the library, you get create an mdsite.DB
object with the path to your
data directory:
mydb = mdsite.DB("/path/to/data/dir")
Then call get_data(path)
for the path into the directory you want, leaving
out the .md
filename suffix, and, if you are looking for an index file, leaving
out index.md
:
data = mydb.get_data("/node/leaf")
The above gets data for $DATA_DIR/node/leaf.md
, or for
$DATA_DIR/node/leaf/index.md
, if that file exists instead.
The library also supports hierarchical configuration, also written in TOML,
YAML, or JSON, stored in files called config.{toml,yaml,json}
depending on the
config language employed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file markdown_site_utils-0.2.2.tar.gz
.
File metadata
- Download URL: markdown_site_utils-0.2.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.1 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ed4f5e337432e91b28b072697424966be60aaca161fc8a3bf345543529c5664 |
|
MD5 | 8fdba0b0c931bf541a8f28476a3e88fd |
|
BLAKE2b-256 | f9ad4bec952e4d52f491310adf449719d43a817853b513d659bd6f072c228b1a |
File details
Details for the file markdown_site_utils-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: markdown_site_utils-0.2.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.1 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd810471405410c94515e1b93fd54e8b96cb9c3e064f47f91d681810f6db9b4b |
|
MD5 | b9528f8bac46527f155a4525d2a62de8 |
|
BLAKE2b-256 | 4fcb6796f9b135e8872a7775ae7a4b5ecd6da4105a3b5be68a7ae2dced27ef89 |