{"id":15403795,"url":"https://github.com/palkan/docsify-namespaced","last_synced_at":"2025-04-16T07:39:58.074Z","repository":{"id":57214237,"uuid":"282170109","full_name":"palkan/docsify-namespaced","owner":"palkan","description":"Docsify plugin to work with namespaces","archived":false,"fork":false,"pushed_at":"2021-06-07T12:11:23.000Z","size":40,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T05:11:45.591Z","etag":null,"topics":["docsify","hacktoberfest"],"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/palkan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-24T08:49:36.000Z","updated_at":"2024-03-14T05:05:05.000Z","dependencies_parsed_at":"2022-08-24T21:41:46.194Z","dependency_job_id":null,"html_url":"https://github.com/palkan/docsify-namespaced","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palkan%2Fdocsify-namespaced","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palkan%2Fdocsify-namespaced/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palkan%2Fdocsify-namespaced/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palkan%2Fdocsify-namespaced/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palkan","download_url":"https://codeload.github.com/palkan/docsify-namespaced/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249213884,"owners_count":21231096,"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":["docsify","hacktoberfest"],"created_at":"2024-10-01T16:10:06.249Z","updated_at":"2025-04-16T07:39:58.042Z","avatar_url":"https://github.com/palkan.png","language":"JavaScript","readme":"# docsify-namespaced\n\nA [docsify](https://docsify.js.org) plugin that makes dealing with _multi-dimensional_ documentation (_namespaces_) simpler:\n\n- Automatically updates sidebar links to match the current namespace.\n- Handles select input interactions (but do not adds `\u003cselect\u003e`-s for you).\n\nThis plugin was built to support multi-language and multi-version documentation for [AnyCable](https://github.com/anycable/docs.anycable.io) and [TestProf](https://github.com/test-prof/docs).\n\n## Installation\n\n```html\n\u003cscript src=\"https://unpkg.com/docsify-namespaced\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n### Minimal example\n\nRegister namespaces in you configuration:\n\n```js\nwindow.$docsify = {\n  namespaces: [\n    {\n      // uniq namespace identifier (no used internally yet but maybe in the future)\n      id: \"lang\",\n      // recognizable values\n      values: [\"ru\", \"de\"],\n      // whether this namespace must be present in the path or not\n      optional: true,\n    },\n    {\n      id: \"version\",\n      values: [\"v1\", \"v2\"],\n      optional: true,\n    }\n  ]\n}\n```\n\nWith the configuration above, whenever the page is loaded, with match the current path using the generated regexp (`/^(\\/(ru|de))?(\\/(v1|v2))?/`),\nand update all the links in the sidebar to start with the matching prefix. For example, if the current page is `/ru/v1/getting_started.md`, we make sure that all sidebar links start with `/ru/v1`.\n\nThis allows us to use relative paths in namespace-specific documentations and do not care about absolute links in the sidebar (thus, no need to update them when new namespace levels are added).\n\n### Adding selectors\n\nA typical way of switching between namespaces is by adding a `\u003cselect\u003e` input. This plugin can integrate with the existing selects.\n\nFor example:\n\n```js\nwindow.$docsify = {\n  name: '\u003ca id=\"home-link\" class=\"app-name-link\" data-nosearch href=\"/\"\u003eHome\u003c/a\u003e' +\n        '\u003cselect id=\"lang-selector\" name=\"lang\"\u003e' +\n          '\u003coption value=\"\"\u003eEnglish\u003c/value\u003e' +\n          '\u003coption value=\"ru\"\u003eРусский\u003c/value\u003e' +\n          '\u003coption value=\"de\"\u003eDeutsch\u003c/value\u003e' +\n        '\u003c/select\u003e',\n  // disable automatic linking to avoid navigating when clicking on select\n  nameLink: false,\n  namespaces: [\n    {\n      id: \"lang\",\n      values: [\"ru\", \"de\"],\n      optional: true,\n      // Specify select element query selector\n      selector: \"#lang-selector\",\n    }\n  ],\n}\n```\n\nNow this plugin takes care of reacting on select changes and also updating the current select value in case of a direct namespaced URL opening.\n\n### Default namespace\n\nYou can specify a default namespace to navigate to on page load (in case no namespace is specified in the url) by adding a default option:\n\n```js\nwindow.$docsify = {\n  namespaces:\n    {\n      id: \"version\",\n      values: [\"v1\", \"v2\"],\n      optional: true,\n      default: \"v2\",\n    }\n  ]\n}\n```\n\n## Acknowledgements\n\nThe project's scaffold is based on [docsify-copy-code](https://github.com/jperasmus/docsify-copy-code).\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](/LICENSE.txt) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalkan%2Fdocsify-namespaced","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalkan%2Fdocsify-namespaced","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalkan%2Fdocsify-namespaced/lists"}