Skip to main content

Small library that can generated paged feeds (json, html, etc) based on a collection of markdown files.

Project description

Markdown Feeds

A fast and efficient tool that can generate paged "feeds" based on Markdown files.

A example use case of this tool is to generate a JSON or HTML feed for some news that you may have.

Core Features:

  • Generate complaint JSON Feed v1.0 feeds
  • Generate HTML feeds
  • Supports pagination, with user defined "items per page"
  • Fast and efficient, uses async based work groups
  • Reads Markdown files in YAML Front-Matter Jekyll Format
  • Markdown files can provide yaml based "front-matter" allowing extra details to be provided to feed

Simple JSON Feed Example

This tool can be used to take the below files:

Example Code

from markdownfeeds.Generators.Json.JsonFeedGenerator import JsonFeedGenerator
from markdownfeeds.Generators.Json.JsonFeedGeneratorSettings import JsonFeedGeneratorSettings
from markdownfeeds.Generators.Json.Models.JsonFeed import JsonFeed

JsonFeedGenerator(
    feed=JsonFeed(title='Captain\'s Log 1'),
    generator_settings=JsonFeedGeneratorSettings(
        source_directory='../1-simple-json-feed/logs',
        target_directory='json/log1',
    )
).run_standalone()

Input

File 1: 2024-02-02-hello-world.md:

---
title: "Hello World!"
author: "Jean-Luc Picard"
---

Make it so!

File 2: 2024-02-06-another-test-file.md:

---
title: "Another Test File"
author: "Kathryn Janeway"
location: "Delta Quadrant"
---

Tom, warp 6.

Output

If you run the above files via the tool using JsonFeedGenerator generator, the output would be similar to:

{
  "version": "https://jsonfeed.org/version/1",
  "title": "News Feed",
  "items": [
    {
      "id": "11581cc76bfff77669ebd94621959b016416e48d",
      "title": "Another Test File",
      "summary": "Tom, warp 6.",
      "date_published": "2024-02-06T00:00:00",
      "author": "Kathryn Janeway",
      "_location": "Delta Quadrant"
    },
    {
      "id": "de9d22cb5f4a20a3aeb00d156e086122148cd141",
      "title": "Hello World!",
      "summary": "Make it so!",
      "date_published": "2024-02-02T00:00:00",
      "author": "Jean-Luc Picard"
    }
  ],
  "_total_items": 2,
  "_total_pages": 1
}

More Examples

There are a few additional examples available below:

Extending

You can extend the functionality of this tool by adding support for new feed types. To do this, please create a new feed class and extend the "BaseFeed" class.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

markdownfeeds-1.9.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file markdownfeeds-1.9.0-py3-none-any.whl.

File metadata

  • Download URL: markdownfeeds-1.9.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for markdownfeeds-1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a26e0f09da04c9eee0c71c21bb69da3bd41e05723f9263829e6eaf4c0391329
MD5 37514f9e9a8ac9ca5edde4133e13fad0
BLAKE2b-256 d0945919c09fd061510c2201ec63fd7a853da6b2172d53dc479e891b3b527619

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