Exclude or redirect auto-generated pages
IjzerenHein opened this issue Β· comments
Hi, first of all, thanks for this great plugin, awesome work π π π
Hey I have a question or rather a suggestion. I can probably implement it myself through a PR, but I'd first want to know your thoughts on this before I proceed.
I have a documentation site where some pages are auto-generated API pages (from source). The edit-link is therefore different for these pages, it should point to the source-file, rather than the .md file. To support this, I had the following suggestion in mind, to extend the docEditBase
argument so that it also supports a function. And in case it is a function, it is called for that particular page to request the edit-link. And when the function returns false
it would disable editing of that page entirely. This would give you some control of which pages are editable and where they live, while keeping the API backwards compatible.
Example:
<script>
window.$docsify = {
// your config
// ...
plugins: [
EditOnGithubPlugin.create(
"https://github.com/IjzerenHein/firestorter/blob/feature-geoquery/docs/",
function(docName, vm) {
// Point the auto-generated docs to the correct source file
if (docName.indexOf('api') >= 0) {
return "https://github.com/IjzerenHein/firestorter/edit/feature-geoquery/src/" + docName.trim('.md') + '.ts';
// Disable editing of external pages
} else if (docName.indexOf('external') >= 0){
return false;
}
}
)
]
}
</script>
I'd love to hear what you think :D
cheers, Hein
It's a good idea, notice to be compatible to previous version.
.. notice to be compatible to previous version.
Check π