{"id":15636586,"url":"https://github.com/danwebb/jdown","last_synced_at":"2025-05-05T03:42:51.346Z","repository":{"id":40750870,"uuid":"129258510","full_name":"DanWebb/jdown","owner":"DanWebb","description":"Transform a directory of markdown files to JSON","archived":false,"fork":false,"pushed_at":"2022-12-07T14:21:01.000Z","size":3134,"stargazers_count":117,"open_issues_count":6,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T03:42:39.290Z","etag":null,"topics":["jamstack","javascript","json","markdown","static-site"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/DanWebb.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-12T13:48:54.000Z","updated_at":"2024-02-12T06:43:44.000Z","dependencies_parsed_at":"2023-01-24T17:31:53.277Z","dependency_job_id":null,"html_url":"https://github.com/DanWebb/jdown","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanWebb%2Fjdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanWebb%2Fjdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanWebb%2Fjdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanWebb%2Fjdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanWebb","download_url":"https://codeload.github.com/DanWebb/jdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252436240,"owners_count":21747467,"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":["jamstack","javascript","json","markdown","static-site"],"created_at":"2024-10-03T11:05:17.605Z","updated_at":"2025-05-05T03:42:51.310Z","avatar_url":"https://github.com/DanWebb.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/DanWebb/jdown.svg?branch=master)](https://travis-ci.org/DanWebb/jdown)\n[![Node Version](https://img.shields.io/badge/node-%3E=8-blue.svg)](https://img.shields.io/badge/node-%3E=8-blue.svg)\n\nIf you're creating content in markdown or use a CMS like\n[NetlifyCMS](https://www.netlifycms.org/) which outputs markdown files, jdown\ncan transform the content into JSON containing HTML at build time, ready to be\nconsumed within templates.\n\n## Install\n\n```console\n$ npm install jdown --save-dev\n```\n\n## Basic Usage\n\n```js\nconst jdown = require('jdown');\njdown('path/to/content').then(content =\u003e console.log(content));\n```\n\nCall jdown with the path to your markdown content (relative to the project root)\nand it will convert your content to JSON.\n\n## Structuring Content\n\nThe structure of the JSON that jdown outputs depends on how files within the\ncontent folder are structured.\n\n### 📄 Files\n\nWill be turned into an object, file objects will always contain a `contents` and\n`fileInfo` property...\n\n### 📂 Files within folders\n\nWill be turned into individual objects then grouped within a parent object that\nhas the same name as the parent folder (don't go more than one level deep).\n\n### 🗄 Collections\n\nTo generate arrays of file objects a folder named \"collections\" can be created.\nThe collections folder should only contain sub folders, each then each file\nwithin a sub folder will be added to an array of objects.\n\n### 📝 File Contents\n\nYAML frontmatter can be included at the top of any files throughout and it will\nbe added to the generated JSON as individual properties.\n\n```md\n---\ntitle: Example frontmatter\n---\n\nExample Markdown Content\n```\n\n## API\n\n### jdown([path], [options])\n\n#### path\n\nType: `string`\u003cbr\u003e Required\n\nPath to a folder containing markdown files with a folder structure that matches\nthe guidelines above. The path should be relative to the project root so if your\ncontent was in `/Users/username/project/src/content`, you would use\n`jdown('src/content')`.\n\n#### options\n\nType: `object`\n\n##### markdown\n\nType: `object`\n\nOptions to pass to [marked](https://github.com/markedjs/marked), jdown supports\n[all the available marked options](https://marked.js.org/#/USING_ADVANCED.md#options)\nwhich can be used to control how the markdown is parsed.\n\n##### assets\n\nType: `object`\n\nAsset parsing options. Using jdown to parse assets is completely optional, but\ncomes with a few benefits including:\n\n- Ability to organise assets alongside markdown content\n- Auto minification of image files using\n  [imagemin](https://github.com/imagemin/imagemin)\n- Cache busting, using the last modified time (mtime) of the asset to change its\n  file name and avoid the old version of the asset being served\n\nAll static assets must be placed within `/assets` folders. Assets folders can be\nplaced in the top level content directory and/or it's sub directories. Within\nthe markdown content assets can then be referenced using\n`![](./assets/my-asset.png)` where `my-asset.png` is an asset placed within an\n`/assets` folder.\n\nThe assets options object can contain the following properties:\n\n| Property | Type   | Default   | Description                                                                               |\n| -------- | ------ | --------- | ----------------------------------------------------------------------------------------- |\n| output   | string | ./public  | Directory jdown will output processed assets to                                           |\n| path     | string | /         | Publically accessible path jdown will prepend to output file names                        |\n| png      | object | undefined | Options to pass into [imagemin-pngquant](https://www.npmjs.com/package/imagemin-pngquant) |\n| jpg      | object | undefined | Options to pass into [imagemin-jpegtran](https://www.npmjs.com/package/imagemin-jpegtran) |\n| svg      | object | undefined | Options to pass into [imagemin-svgo](https://www.npmjs.com/package/imagemin-svgo)         |\n| gif      | object | undefined | Options to pass into [imagemin-svgo](https://www.npmjs.com/package/imagemin-svgo)         |\n\n##### parseMd\n\nType: `boolean`\u003cbr\u003e Default: `true`\n\nSet this to `false` to disable markdown parsing and just recieve structured JSON\ncontaining markdown instead of HTML.\n\n##### fileInfo\n\nType: `boolean`\u003cbr\u003e Default: `false`\n\nSet this to `true` to include file info objects in the output JSON which contain\nthe files path, name, created at date and modified at date.\n\n## Examples\n\nThe [example](example/) directory of this repository contains use of jdown\nincluding asset parsing and custom [marked](https://github.com/markedjs/marked)\nrender options.\n\n## Contributing\n\nAny pull requests are welcome and will be reviewed.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanwebb%2Fjdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanwebb%2Fjdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanwebb%2Fjdown/lists"}