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

@ -10,12 +10,13 @@ const path = require('path');
const fs = require('fs-extra');
const {parse, idx, normalizeUrl, generate} = require('@docusaurus/utils');
// TODO: Use a better slugify function that doesn't rely on a specific file extension.
function fileToUrl(fileName) {
return fileName
.replace('-', '/')
.replace('-', '/')
.replace('-', '/')
.replace(/\.md$/, '');
.replace(/\.mdx?$/, '');
}
const DEFAULT_OPTIONS = {
@ -42,6 +43,10 @@ class DocusaurusPluginContentBlog {
return 'docusaurus-plugin-content-blog';
}
getPathsToWatch() {
return [this.contentPath];
}
// Fetches blog contents and returns metadata for the contents.
async loadContent() {
const {pageCount, include, routeBasePath} = this.options;
@ -150,10 +155,6 @@ class DocusaurusPluginContentBlog {
});
});
}
getPathsToWatch() {
return [this.contentPath];
}
}
module.exports = DocusaurusPluginContentBlog;

View file

@ -6,7 +6,6 @@
"license": "MIT",
"dependencies": {
"@docusaurus/utils": "^1.0.0",
"classnames": "^2.2.6",
"fs-extra": "^7.0.1",
"globby": "^9.1.0"
},