Skip to main content

BiteMark

PyPI - Version PyPI - Python Version codecov

Reference implementation for BiteMark - a markup language for recipes based on Markdown.

Why

I was looking for a uniform way to store my collected recipes in digital form. Since I've already stored my notes in Markdown format for many years, it seemed like a reasonable choice for recipes too:

  1. It's human-readable - so are recipes!
  2. It's structured - so are recipes!
  3. It's easily extensible
  4. It's straightforward to format text and lists

Why Not JSON-LD?

Many websites expose recipe metadata in JSON-LD format which is great for extracting the data, but while this is technically human-readable, it's not a great experience.

Specification

Recipe Structure

# <Recipe title>

## Ingredients

- <quantity> <unit> <ingredient>
- <quantity> <unit> <ingredient>

## Instructions

1. Step 1
2. Step 2

E.g. a very simple recipe could look like this:

# Spaghetti Carbonara

## Ingredients

- 200 g spaghetti
- 100 g pancetta

## Instructions

1. Boil pasta.
2. Fry pancetta.

Units

In order to facilitate unit conversion, units are sorted into two categories:

  1. Volume
  2. Mass
  • Volume:
    • ml
    • liter / l
    • cup_us - American cup
    • cup_uk - UK cup
    • cup - Defaults to American cup
    • tablespoon / tbsp
    • teaspoon / tsp
    • pint
  • Mass:
    • g / gram
    • kg / kilogram
    • oz / ounce
    • lb / pound

Non-liquid units can be converted between volume and mass based on a density table.

Multiple Recipes

  • A Markdown file may contain multiple recipes, each beginning with a Markdown header (# or ##).

Metadata (Optional)

Metadata can be placed at the top of the recipe inside an HTML comment block. This is so the metadata won't be rendered. This little syntactic trick is necessary because, sadly, Markdown does not support comments directly.

Here is an example for common metadata:

<!--
servings: 4
cuisine: Italian
units: metric
-->

There are no formal restrictions on which keys can be used in metadata.

However, some keys have special meaning in the reference implementation:

  • servings: Used as the baseline for ingredient scaling when -s / --servings is used.
  • units: Used as the default unit system for display and conversion (metric, american, british) when no CLI unit override is passed.

If servings is missing or invalid, scaling falls back to a baseline of 2 servings.

CLI Usage

Run the interpreter with:

bitemark [-u UNIT|--unit UNIT] [-s SERVINGS|--servings SERVINGS] <markdown_file>

Options:

  • -u, --unit: Override display unit system (for example metric, american, or british).
  • -s, --servings: Scale ingredient quantities to the requested servings.

Examples:

bitemark examples/recipes/milk.md
bitemark -s 6 examples/recipes/milk.md
bitemark --unit american --servings 2 examples/recipes/milk.md

Scaling uses metadata servings as the baseline when present.

Goals of the Default Implementation

  1. Implement specification as completely as possible
  2. Provide test cases to test interpreter against
  3. Act as testbed for changes to the BiteMark spec
  4. Avoid dependencies outside the Python Standard Library

Metadata

Release files for bitemark 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitemark 0.2.0
File Size Uploaded
bitemark-0.2.0.tar.gz 27.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bitemark 0.2.0
File Interpreter ABI Platform
bitemark-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / bitemark-0.2.0.tar.gz

Download URL bitemark-0.2.0.tar.gz
Size 27.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2a63063939b3d188d671f952d7978dbdea77d07b5e3fa1545c941f69b4ca8d6e
BLAKE2b-256 checksum
How to use checksums
fdb4da45c5028972d1bde5f16b2e7e9f95b90fa3971ae96bcf562bef9a0c191f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / bitemark-0.2.0-py3-none-any.whl

Download URL bitemark-0.2.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
047972a0a316ea7bd3b1e1625a427780ab5dde13acb0fa116b93235f2a7e7b73
BLAKE2b-256 checksum
How to use checksums
bf48f8cce0cf36dc1d4171c26ad3da80b00ff64968461110186bf2ca4bf8202e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page