Skip to main content

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


Download files

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

Source Distribution

markdown_site_utils-0.2.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

markdown_site_utils-0.2.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file markdown_site_utils-0.2.1.tar.gz.

File metadata

  • Download URL: markdown_site_utils-0.2.1.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

Hashes for markdown_site_utils-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4ca1f05417d48a5dd9ecfa739d29eac748038cc4ef30e5c8c8ceade3b411b3d0
MD5 8cb33ba5940aaeb6b4c74044eef55981
BLAKE2b-256 d606185ff626e80c3b5bd61609fc253e106829da0c458f582805d8e25d94df4c

See more details on using hashes here.

File details

Details for the file markdown_site_utils-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for markdown_site_utils-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c4334961b3db8d8c754b81de508cb64ecb2f5e844efd90e056cac6a08fff66
MD5 80a74f33d5dcb682eeea625cf2bc21b2
BLAKE2b-256 6d11ce265cec247226b93944f9934054386df4eea90d0f2e736f960efa2ea48e

See more details on using hashes here.

Supported by

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