feat(v2): docs plugin initial work (#1327)

* feat(v2): pluginify docs

* feat(v2): implement docs plugin

* fix(v2): fix bugs in docs plugin for translation and versioning
This commit is contained in:
Yangshun Tay 2019-03-31 11:37:35 -07:00 committed by GitHub
parent c33e874e1c
commit a70d9b6720
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 576 additions and 371 deletions

View file

@ -7,14 +7,12 @@
const globby = require('globby');
const path = require('path');
// TODO: Do not make it relative because plugins can be from node_modules.
const {encodePath, fileToPath, idx} = require('@docusaurus/utils');
const DEFAULT_OPTIONS = {
metadataKey: 'pagesMetadata',
metadataFileName: 'pagesMetadata.json',
path: 'pages', // Path to data on filesystem.
path: 'pages', // Path to data on filesystem, relative to site dir.
routeBasePath: '', // URL Route.
include: ['**/*.{js,jsx}'], // Extensions to include.
component: '@theme/Pages',
@ -31,6 +29,10 @@ class DocusaurusPluginContentPages {
return 'docusaurus-plugin-content-pages';
}
getPathsToWatch() {
return [this.contentPath];
}
async loadContent() {
const {include} = this.options;
const {env, siteConfig} = this.context;
@ -102,10 +104,6 @@ class DocusaurusPluginContentPages {
});
});
}
getPathsToWatch() {
return [this.contentPath];
}
}
module.exports = DocusaurusPluginContentPages;