{"id":16350507,"url":"https://github.com/zspecza/reshape-rss","last_synced_at":"2025-07-11T00:09:55.781Z","repository":{"id":66011725,"uuid":"61393721","full_name":"zspecza/reshape-rss","owner":"zspecza","description":"Reshape plugin for RSS feeds","archived":false,"fork":false,"pushed_at":"2020-06-01T01:14:19.000Z","size":75,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T12:28:25.132Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zspecza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-17T18:18:38.000Z","updated_at":"2019-02-15T06:47:57.000Z","dependencies_parsed_at":"2023-04-18T01:35:42.103Z","dependency_job_id":null,"html_url":"https://github.com/zspecza/reshape-rss","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.16666666666666663","last_synced_commit":"3bd0a814c76c1437e15a1d3694737022e3e2bfda"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zspecza/reshape-rss","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Freshape-rss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Freshape-rss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Freshape-rss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Freshape-rss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zspecza","download_url":"https://codeload.github.com/zspecza/reshape-rss/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zspecza%2Freshape-rss/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264696502,"owners_count":23650937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T01:05:13.988Z","updated_at":"2025-07-11T00:09:55.751Z","avatar_url":"https://github.com/zspecza.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/declandewet/reshape-rss.svg?branch=master)](https://travis-ci.org/declandewet/reshape-rss)\n[![codecov](https://codecov.io/gh/declandewet/reshape-rss/branch/master/graph/badge.svg)](https://codecov.io/gh/declandewet/reshape-rss)\n[![dependencies Status](https://david-dm.org/declandewet/reshape-rss/status.svg)](https://david-dm.org/declandewet/reshape-rss)\n[![devDependencies Status](https://david-dm.org/declandewet/reshape-rss/dev-status.svg)](https://david-dm.org/declandewet/reshape-rss?type=dev)\n\n# reshape-rss\n\n[Reshape](https://github.com/reshape/reshape) plugin for generating RSS feeds.\n\n\u003e **Note**: this project is still in early development and not all features may be implemented yet.\n\n### Example Usage\n\n```js\nconst reshape = require('reshape')\nconst rss = require('reshape-rss')\n\nlet feed = {}\n\nreshape({\n  plugins: [\n    rss(feed)\n  ]\n})\n  .process(`\n    \u003cmain role=\"main\" rss-channel rss-language=\"en-US\"\u003e\n      \u003ca href=\"http://mysite.com/blog\" rss-link\u003e\n        \u003ch1 rss-title\u003eBlog Posts\u003c/h1\u003e\n      \u003c/a\u003e\n      \u003cp rss-description\u003eRead the latest posts from my blog\u003c/p\u003e\n      \u003carticle rss-item rss-category=\"random\"\u003e\n        \u003ch2 rss-title\u003eThe Genius Loki of Utopia\u003c/a\u003e\u003c/h2\u003e\n        \u003ctime rss-pubDate\u003e12 July 2013, 11:13\u003c/time\u003e\n        \u003cp rss-description\u003eA sample blog post\u003c/p\u003e\n        \u003cfooter rss-author\u003eJoe West\u003c/footer\u003e\n        \u003ca href=\"http://mysite.com/blog/the-genius-loki-of-utopia/#/comments\"\n           rss-comments\u003e31 Comments\u003c/a\u003e\n        \u003ca href=\"http://mysite.com/blog/the-genius-loki-of-utopia\"\n           rss-link\n           rss-guid\u003eRead More\u003c/a\u003e\n      \u003c/article\u003e\n      \u003cfooter rss-copyright\u003e© mysite.com 2013\u003c/footer\u003e\n    \u003c/main\u003e\n  `)\n  .then((result) =\u003e {\n    console.log(rss.convertToXML(feed))\n  })\n```\n\n![arrow pointing down](http://imgh.us/downarrow_1.png)\n\n```xml\n\u003c!doctype xml\u003e\n\u003crss\n  version=\"2.0\"\n  xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n  xmlns:atom=\"http://www.w3.org/2005/Atom\"\u003e\n  \u003cchannel\u003e\n    \u003ctitle\u003eBlog Posts\u003c/title\u003e\n    \u003cdescription\u003eRead the latest posts from my blog\u003c/description\u003e\n    \u003ccopyright\u003e© mysite.com 2013\u003c/copyright\u003e\n    \u003cgenerator\u003ereshape-rss\u003c/generator\u003e\n    \u003clink\u003ehttp://mysite.com/blog\u003c/link\u003e\n    \u003clastBuildDate\u003eSat, 13 Jul 2013 13:12:00 EST\u003c/lastBuildDate\u003e\n    \u003cpubDate\u003eFri, 12 Jul 2013 11:13:00 EST\u003c/pubDate\u003e\n    \u003clanguage\u003een-US\u003c/language\u003e\n    \u003citem\u003e\n      \u003ctitle\u003eThe Genius Loki of Utopia\u003c/title\u003e\n      \u003cdescription\u003eA sample blog post\u003c/description\u003e\n      \u003cauthor\u003eJoe West\u003c/author\u003e\n      \u003cpubDate\u003eFri, 12 Jul 2013 11:13:00 EST\u003c/pubDate\u003e\n      \u003clink\u003ehttp://mysite.com/blog/the-genius-loki-of-utopia\u003c/link\u003e\n      \u003cguid isPermaLink=\"true\"\u003ehttp://mysite.com/blog/the-genius-loki-of-utopia\u003c/guid\u003e\n      \u003ccategory\u003erandom\u003c/category\u003e\n      \u003ccomments\u003ehttp://mysite.com/blog/the-genius-loki-of-utopia/#/comments\u003c/comments\u003e\n    \u003c/item\u003e\n  \u003c/channel\u003e\n\u003c/rss\u003e\n```\n\n### Installation\n\n```sh\n$ npm install reshape-rss --save\n```\n\n\n\n### Pass an empty object to `rss`\n\n`reshape-rss` takes one option: an empty object. As your HTML file is parsed for `rss-*` attributes, this object will be populated with information about your RSS feed. For the example above, it would look like this once parsing is done:\n\n```js\n{\n  channels: [{\n    title: 'Blog Posts',\n    description: 'Read the latest posts from my blog',\n    link: 'http://mysite.com/blog',\n    copyright: '© mysite.com 2013',\n    language: 'en-US',\n    lastBuildDate: 'Sat, 13 Jul 2013 13:12:00 EST',\n    pubDate: 'Fri, 12 Jul 2013 11:13:00 EST'\n    items: [{\n      title: 'The Genius Loki of Utopia',\n      description: 'A sample blog post',\n      author: 'Joe West',\n      pubDate: 'Fri, 12 Jul 2013 11:13:00 EST',\n      link: 'http://mysite.com/blog/the-genius-loki-of-utopia',\n      guid: {\n        isPermaLink: true,\n        value: 'http://mysite.com/blog/the-genius-loki-of-utopia'\n      },\n      categories: ['random'],\n      comments: 'http://mysite.com/blog/the-genius-loki-of-utopia/#/comments'\n    }]\n  }]\n}\n```\n\n### Converting to XML\n\nYou can use the `rss.convertToXML()` method to convert your feed object to a string of XML. You can then do whatever you like with this string, like write it out to a file.\n\n```js\nconst rss = require('reshape-rss')\nrss.convertToXML(feed) // =\u003e \"\u003c!doctype xml\u003e\u003crss\u003e...\u003c/rss\u003e\"\n```\n\n\n\n### Merging Many Feeds\n\n`reshape-rss` exposes one more method: `rss.mergeFeeds()`. Pass this method two or more feed objects, and it will merge them together. It's useful if you are working with multiple files that produce multiple RSS feeds but you only want to render them out to one XML file.\n\n```js\nconst rss = require('reshape-rss')\nrss.mergeFeeds({\n  channels: [{\n    title: 'Foo',\n    description: 'Bar',\n    link: 'http://baz.com'\n  }]\n}, {\n  channels: [{\n    title: 'Fizz',\n    description: 'Buzz',\n    link: 'http://fizzbuzz.com'\n  }]\n})\n/* =\u003e {\n  channels: [{\n    title: 'Foo',\n    description: 'Bar',\n    link: 'http://baz.com'\n  }, {\n    title: 'Fizz',\n    description: 'Buzz',\n    link: 'http://fizzbuzz.com'\n  }]\n} */\n```\n\n\n\n### Specifying Attributes\n\nIn your HTML file, you can specify an `rss-channel` attribute on any element. An element with an `rss-channel` attribute can have other `rss-*` attributes directly on or as a descendant of itself. These attributes will become properties of the `rss-channel`. One HTML file can have many `rss-channel` attributes. A channel requires an `rss-title`, `rss-description` and `rss-link` attribute.\n\n```html\n\u003cmain rss-channel\u003e\n  \u003ch1 rss-title\u003eFoo\u003c/h1\u003e \u003c!-- becomes \"title\" of channel --\u003e\n  \u003cp rss-description\u003ebar\u003c/p\u003e \u003c!-- becomes \"description\" of channel --\u003e\n  \u003ca href=\"https://site.com/foo\" rss-link\u003eGo to foo\u003c/a\u003e \u003c!-- becomes \"link\" of channel --\u003e\n  ...\n\u003c/main\u003e\n```\n\nAn `rss-channel` attribute must have at least one child with an `rss-item` attribute. Any `rss-*` attributes directly on or descendant of an `rss-item` attribute will become properties of that `rss-item`. An item requires an `rss-title`, `rss-description` and `rss-link` attribute. An `rss-channel` can have many descendant `rss-item`s.\n\n```html\n\u003cmain rss-channel\u003e\n  \u003ch1 rss-title\u003eFoo\u003c/h1\u003e\n  \u003cp rss-description\u003ebar\u003c/p\u003e\n  \u003ca href=\"https://site.com/foo\" rss-link\u003eGo to foo\u003c/a\u003e\n  \u003carticle rss-item\u003e \u003c!-- this item belongs to it's parent channel --\u003e\n    \u003ch2 rss-title\u003eFizz\u003c/h2\u003e \u003c!-- becomes \"title\" of item --\u003e\n    \u003cp rss-description\u003eBazz\u003c/p\u003e \u003c!-- becomes \"description\" of item --\u003e\n    \u003ca href=\"https://site.com/foo/fizz\" rss-link\u003eRead More\u003c/a\u003e \u003c!-- becomes \"link\" of item --\u003e\n  \u003c/article\u003e\n\u003c/main\u003e\n```\n\n\n\nThe attributes can be specified anywhere in the markup **as long as** the properties of `rss-channel` are placed on or within `rss-channel`, an `rss-item` occurs only within an `rss-channel`, and properties of `rss-item` are placed on or within `rss-item`.\n\nMost `rss-*` attributes will attempt to infer their value from the `.innerText` property of the HTML node they are placed on, however, special case is given to `rss-guid`, `rss-link` and `rss-comments`, which will grab their value from their elements' `href` attribute if present. You may override this behavior by passing in a value directly, like so:\n\n```html\n\u003cmain rss-channel rss-title=\"Custom Title\"\u003e\n  \u003ch1\u003eFoo\u003c/h1\u003e\n  \u003cp rss-description=\"Wow such doge\"\u003ebar\u003c/p\u003e\n  \u003ca href=\"https://site.com/foo\" rss-link\u003eGo to foo\u003c/a\u003e\n  \u003carticle rss-item rss-link=\"http://google.com\"\u003e\n    \u003ch2 rss-title=\"Custom Title\"\u003eFizz\u003c/h2\u003e\n    \u003cp rss-description\u003eBazz\u003c/p\u003e\n    \u003ca href=\"https://site.com/foo/fizz\"\u003eRead More\u003c/a\u003e\n  \u003c/article\u003e\n\u003c/main\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzspecza%2Freshape-rss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzspecza%2Freshape-rss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzspecza%2Freshape-rss/lists"}