{"id":13704869,"url":"https://github.com/rdilweb/docusaurus-plugin-remote-content","last_synced_at":"2025-05-16T15:09:33.091Z","repository":{"id":37743386,"uuid":"335734179","full_name":"rdilweb/docusaurus-plugin-remote-content","owner":"rdilweb","description":"A Docusaurus plugin to download content from remote sources when it is needed.","archived":false,"fork":false,"pushed_at":"2025-04-16T15:34:30.000Z","size":5365,"stargazers_count":108,"open_issues_count":18,"forks_count":14,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-15T07:22:50.839Z","etag":null,"topics":["docusaurus","plugin"],"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/rdilweb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2021-02-03T19:35:43.000Z","updated_at":"2025-05-08T18:37:19.000Z","dependencies_parsed_at":"2023-02-19T02:00:31.489Z","dependency_job_id":"d2c449f2-719d-451b-913b-5c0d5b613b6e","html_url":"https://github.com/rdilweb/docusaurus-plugin-remote-content","commit_stats":{"total_commits":60,"total_committers":6,"mean_commits":10.0,"dds":0.5,"last_synced_commit":"e329e22ee56359bc41e94ef4be2bac0bfdc4e63b"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":"rdilweb/template-docusaurus-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdilweb%2Fdocusaurus-plugin-remote-content","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdilweb%2Fdocusaurus-plugin-remote-content/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdilweb%2Fdocusaurus-plugin-remote-content/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdilweb%2Fdocusaurus-plugin-remote-content/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rdilweb","download_url":"https://codeload.github.com/rdilweb/docusaurus-plugin-remote-content/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553958,"owners_count":22090417,"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":["docusaurus","plugin"],"created_at":"2024-08-02T22:00:21.847Z","updated_at":"2025-05-16T15:09:28.079Z","avatar_url":"https://github.com/rdilweb.png","language":"TypeScript","readme":"# docusaurus-plugin-remote-content\n\nA Docusaurus plugin that downloads content from remote sources.\n\nWith this plugin, you can write the Markdown for your content somewhere else, and use them on your Docusaurus site, without copying and pasting.\n\n## Installing\n\nRun this in a terminal:\n\n```bash\nyarn add docusaurus-plugin-remote-content\n```\n\n## Choosing a Mode\n\nThis plugin has 2 modes, and you can choose which to use depending on your needs.\n\n### Constant Sync\n\nThis is the default mode.\nYou will want to gitignore the docs/blog directory that the plugin downloads content to,\nas every time you run `docusaurus build` or `docusaurus start`, the content is downloaded,\n(and when it stops, the local copy of the content is deleted - this is configurable).\n\n### CLI Sync\n\nThis is the secondary mode. You can use the Docusaurus CLI to update the content when needed.\nAll you need to do is run `docusaurus download-remote-X`, where X is the `name` option given to the plugin.\nYou can also use `docusaurus clear-remote-X` to remove the downloaded files.\n\nTo enable CLI Sync set `noRuntimeDownloads: true` in the options.\n\n## Alright, so how do I use this??\n\nOkay. Assuming you want to use constant sync, follow these steps:\n\n1. In your `docusaurus.config.js`, if you don't already, create a plugin array, and add this plugin. For example:\n\n```javascript\nmodule.exports = {\n    // ...\n    plugins: [\n        [\n            \"docusaurus-plugin-remote-content\",\n            {\n                // options here\n                name: \"some-content\", // used by CLI, must be path safe\n                sourceBaseUrl: \"https://my-site.com/content/\", // the base url for the markdown (gets prepended to all of the documents when fetching)\n                outDir: \"docs\", // the base directory to output to.\n                documents: [\"my-file.md\", \"README.md\"], // the file names to download\n            },\n        ],\n    ],\n}\n```\n\n2. Configure the plugin - see the list of options below.\n\n## Options\n\n### `name`\n\n(_Required_) `string`\n\nThe name of this plugin instance. Set to `content` if you aren't sure what this does. (used by CLI)\n\n### `sourceBaseUrl`\n\n(_Required_) `string`\n\nThe base URL that your remote docs are located.\nAll the IDs specified in the `documents` option will be resolved relative to this.\nFor example, if you have 2 docs located at https://example.com/content/hello.md and https://example.com/content/thing.md,\nthe `sourceBaseUrl` would need to be set to https://example.com/content/.\n\n### `outDir`\n\n(_Required_) `string`\n\nThe folder to emit the downloaded content to.\n\n### `documents`\n\n(_Required_) `string[]` or `Promise\u003cstring[]\u003e`\n\nThe documents to fetch. Must be file names (e.g. end in `.md`)\nFollowing the previous example, if you had set `sourceBaseUrl` to https://example.com/content/,\nand wanted to fetch thing.md and hello.md, you would just set `documents` to `[\"hello.md\", \"thing.md\"]`\n\n### `performCleanup`\n\n(Optional) `boolean` - default = `true`\n\nIf the documents downloaded should be deleted after the build is completed. Defaults to true.\n\n### `noRuntimeDownloads`\n\n(Optional) `boolean` - default = `false`\n\nIf you only want to use the Docusaurus CLI to download the remote content, you should change this to true.\n\n### `requestConfig`\n\n(optional) [`AxiosRequestConfig`](https://axios-http.com/docs/req_config)\n\nAdditional configuration options for the network requests that fetch the content.\nSee the documentation for details: https://axios-http.com/docs/req_config\n\n### `modifyContent`\n\n(optional) `(filename: string, content: string) =\u003e { filename?: string, content?: string }}`\n\nThis option accepts a function that gets the name of the output file and the content of it as a string,\nand can return a modified version of either. The return value must be either undefined (which means \"skip modifying this thing\"),\nor an object containing the keys `filename` and/or `content`, containing the values you want to use.\n\nFor example, this would add front matter to files that have the word \"README\" in their names:\n\n```js\n// in the plugin's options:\nmodifyContent(filename, content) {\n    if (filename.includes(\"README\")) {\n        return {\n            content: `---\ndescription: We are now adding a front matter field to any README files!\n---\n\n${content}`, // \u003c-- this last part adds in the rest of the content, which would otherwise be discarded\n        }\n    }\n\n    // we don't want to modify this item, since it doesn't contain \"README\" in the name\n    return undefined\n},\n```\n\n## Fetching Images\nTo fetch images you need to have 2 instances of the plugin - 1 for markdown, and the other for images. With the images one, you would add `requestConfig: { responseType: \"arraybuffer\" }`\n\n### Example\n```javascript\nmodule.exports = {\n    // ...\n    plugins: [\n        [\n            \"docusaurus-plugin-remote-content\",\n            {\n                // options here\n                name: \"markdown-content\", // used by CLI, must be path safe\n                sourceBaseUrl: \"https://my-site.com/content/\", // the base url for the markdown (gets prepended to all of the documents when fetching)\n                outDir: \"docs\", // the base directory to output to.\n                documents: [\"my-file.md\", \"README.md\"], // the file names to download\n            },\n        ],\n        [\n            \"docusaurus-plugin-remote-content\",\n            {\n                // options here\n                name: \"images-content\", // used by CLI, must be path safe\n                sourceBaseUrl: \"https://my-site.com/content/\", // the base url for the markdown (gets prepended to all of the documents when fetching)\n                outDir: \"docs\", // the base directory to output to.\n                documents: [\"my-image.png\", \"cool.gif\"], // the file names to download\n                requestConfig: { responseType: \"arraybuffer\" }\n            },\n        ],\n    ],\n}\n```\n\n\n## Contributing\n\nIt isn't really that hard. Follow these simple steps!:\n\n1. Clone a fork of this repository locally using your IDE of choice.\n2. Edit the source.\n3. Run `yarn build`.\n4. Start the test site (`yarn testsite:start`).\n5. You now have the test site running the plugin.\n\nWhen you update the plugin, in order to preview your changes on the test site, you need to:\n\n1. Quit the dev server.\n2. Make your changes.\n3. Rerun `yarn build`.\n4. Restart the test site (`yarn testsite:start`).\n","funding_links":[],"categories":["Plugins","TypeScript"],"sub_categories":["Data sources"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdilweb%2Fdocusaurus-plugin-remote-content","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdilweb%2Fdocusaurus-plugin-remote-content","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdilweb%2Fdocusaurus-plugin-remote-content/lists"}