Skip to content

myx0m0p/feed2md

feed2md

npm version CI License: MIT Node.js >=24

feed2md converts RSS and Atom feeds into clean Markdown.

It ships as:

  • a library package: feed2md
  • a CLI package: feed2md-cli

Why this project

  • Quickly archive feed updates as Markdown
  • Generate changelog-like digests from feeds
  • Reuse the parser + markdown renderer in your own tooling

Installation

Library (npm)
npm install feed2md
Library (pnpm)
pnpm add feed2md
CLI (npm)
npx feed2md-cli <feed-url> [options]
CLI (pnpm)
pnpm dlx feed2md-cli <feed-url> [options]

CLI usage

npm (npx)
npx feed2md-cli <feed-url> [options]
pnpm
pnpm dlx feed2md-cli <feed-url> [options]

Options:

  • -o, --output <file>: write output to file
  • --limit <number>: limit article count
  • --no-summary: skip preview text
  • --summary-max-length <number>: truncate summary preview
  • --template <preset>: built-in template preset (short or full, default: short)
  • --template-file <path>: load a custom Eta template file

Examples:

# print to stdout
npx feed2md-cli https://example.com/feed.xml

# write to a file
npx feed2md-cli https://example.com/feed.xml --output feed.md

# limit items and shorten previews
npx feed2md-cli https://example.com/feed.xml --limit 5 --summary-max-length 140

# render with full metadata template
npx feed2md-cli https://example.com/feed.xml --template full

# render with a custom Eta template file
npx feed2md-cli https://example.com/feed.xml --template-file ./templates/feed.eta

Library usage

import { feed2md } from 'feed2md'

const markdown = await feed2md('https://example.com/feed.xml', {
  limit: 10,
  includeSummary: true,
  summaryMaxLength: 220,
  templatePreset: 'short', // default
})

console.log(markdown)

API

feed2md(url, options?)

Fetches a feed and returns Markdown.

Options (Feed2MdOptions):

  • fetchImpl?: typeof fetch
  • includeSummary?: boolean (default: true)
  • limit?: number
  • summaryMaxLength?: number (default: 280)
  • templatePreset?: 'short' | 'full' (default: 'short')
  • template?: string (custom Eta template content; overrides templatePreset)

parseFeed(xml)

Parses RSS/Atom XML into a normalized ParsedFeed object.

Normalized data now includes feed/item metadata such as:

  • links (link + links[] with rel/type)
  • ids (guid/id)
  • authors (dc:creator / Atom author)
  • categories (RSS category, Atom category term)
  • media payloads (media:content, media:group, media:credit, media:description)
  • feed-level metadata (description, language, copyright, generator, ttl, image)

toMarkdown(feed, options?)

Renders normalized feed data to Markdown.

Supports:

  • toMarkdown(feed, 5) (legacy numeric limit)
  • toMarkdown(feed, { limit, includeSummary, summaryMaxLength, templatePreset, template })

Built-in templates:

  • short (default): compact output for title/link/date/summary
  • full: includes all normalized feed/item metadata

Custom templates use Eta syntax and receive context as it:

  • it.feed: rendered feed view (title, source, fullLines)
  • it.items: rendered item views (header, shortLines, fullLines)
  • it.raw: raw normalized ParsedFeed
  • it.includeSummary: effective summary toggle
  • it.preset: selected preset (short or full)

Input/Output Samples

See docs/SAMPLES.md for concrete XML input and rendered markdown output examples.

Does RSS/Atom include article preview text?

Often yes, but it depends on the feed publisher.

Common fields used by feed2md:

  • RSS: description, content:encoded, content, dc:description, dc:creator, category, guid, media:*
  • Atom: summary, content, subtitle, author, category, id, link, updated, published

If no summary-like field exists, output includes title/link/published date only.

Development

pnpm install
pnpm lint
pnpm test
pnpm build

Useful scripts:

  • pnpm format
  • pnpm format:check
  • pnpm changeset
  • pnpm test:watch

Release

This repo uses Changesets + GitHub Actions.

  1. Add a changeset in feature/fix PRs:

    pnpm changeset
  2. Merge to main. The Release workflow will open/update a version PR.

  3. Merge the version PR to publish to npm.

Contributing

License

MIT. See LICENSE.

About

Convert RSS/Atom feeds to Markdown - library and CLI

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors