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.8.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: markdownfeeds-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 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.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06fc5d7620f2aee39a802604f2483a90dd80d6af2318b7a8122f9a12aa4ce525
MD5 c1cc01ed7097167be3617d2f33d7f469
BLAKE2b-256 5d0861be7e55cd086e8daa121b72b528d45b1821114fb12450e28ce75006414d

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