refactor(v2): simplify code by removing wip i18n & translation (#1431)

* refactor(v2): remove i18n & versioning + cleaner code

* totally remove i18n and versioning from plugin
This commit is contained in:
Endi 2019-05-02 17:24:47 +07:00 committed by GitHub
parent 0813920349
commit 373d17ee72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
123 changed files with 170 additions and 4162 deletions

View file

@ -15,7 +15,7 @@ module.exports = {
moduleNameMapper: { moduleNameMapper: {
'^@lib/(.*)$': '<rootDir>/packages/docusaurus/lib/$1', '^@lib/(.*)$': '<rootDir>/packages/docusaurus/lib/$1',
}, },
testPathIgnorePatterns: ['/node_modules/', '__fixtures__'], testPathIgnorePatterns: ['loadSetup.js', '/node_modules/', '__fixtures__'],
transform: { transform: {
'^.+\\.js$': '<rootDir>/jest.transform.js', '^.+\\.js$': '<rootDir>/jest.transform.js',
}, },

View file

@ -8,7 +8,7 @@
const globby = require('globby'); const globby = require('globby');
const path = require('path'); const path = require('path');
const fs = require('fs-extra'); const fs = require('fs-extra');
const {parse, idx, normalizeUrl, docuHash} = require('@docusaurus/utils'); const {parse, normalizeUrl, docuHash} = require('@docusaurus/utils');
// TODO: Use a better slugify function that doesn't rely on a specific file extension. // TODO: Use a better slugify function that doesn't rely on a specific file extension.
function fileToUrl(fileName) { function fileToUrl(fileName) {
@ -50,7 +50,7 @@ class DocusaurusPluginContentBlog {
// Fetches blog contents and returns metadata for the contents. // Fetches blog contents and returns metadata for the contents.
async loadContent() { async loadContent() {
const {pageCount, include, routeBasePath} = this.options; const {pageCount, include, routeBasePath} = this.options;
const {env, siteConfig} = this.context; const {siteConfig} = this.context;
const blogDir = this.contentPath; const blogDir = this.contentPath;
const {baseUrl} = siteConfig; const {baseUrl} = siteConfig;
@ -61,9 +61,6 @@ class DocusaurusPluginContentBlog {
// Prepare metadata container. // Prepare metadata container.
const blogMetadata = []; const blogMetadata = [];
// Language for each blog page.
const defaultLangTag = idx(env, ['translation', 'defaultLanguage', 'tag']);
await Promise.all( await Promise.all(
blogFiles.map(async relativeSource => { blogFiles.map(async relativeSource => {
const source = path.join(blogDir, relativeSource); const source = path.join(blogDir, relativeSource);
@ -89,7 +86,6 @@ class DocusaurusPluginContentBlog {
source, source,
...rawMetadata, ...rawMetadata,
date, date,
language: defaultLangTag,
}; };
blogMetadata.push(metadata); blogMetadata.push(metadata);
}), }),
@ -108,7 +104,6 @@ class DocusaurusPluginContentBlog {
page > 0 page > 0
? normalizeUrl([basePageUrl, `page/${page + 1}`]) ? normalizeUrl([basePageUrl, `page/${page + 1}`])
: basePageUrl, : basePageUrl,
language: defaultLangTag,
isBlogPage: true, isBlogPage: true,
posts: blogMetadata.slice(page * pageCount, (page + 1) * pageCount), posts: blogMetadata.slice(page * pageCount, (page + 1) * pageCount),
}); });

View file

@ -31,87 +31,4 @@ Object {
} }
`; `;
exports[`loadSidebars site with sidebars & versioned sidebars 1`] = `
Object {
"docs": Array [
Object {
"items": Array [
Object {
"id": "foo/bar",
"type": "doc",
},
Object {
"id": "foo/baz",
"type": "doc",
},
],
"label": "Test",
"type": "category",
},
Object {
"items": Array [
Object {
"id": "hello",
"type": "doc",
},
],
"label": "Guides",
"type": "category",
},
],
"version-1.0.0-docs": Array [
Object {
"items": Array [
Object {
"id": "version-1.0.0-foo/bar",
"type": "doc",
},
Object {
"id": "version-1.0.0-foo/baz",
"type": "doc",
},
],
"label": "Test",
"type": "category",
},
Object {
"items": Array [
Object {
"id": "version-1.0.0-hello",
"type": "doc",
},
],
"label": "Guides",
"type": "category",
},
],
"version-1.0.1-docs": Array [
Object {
"items": Array [
Object {
"id": "version-1.0.1-foo/bar",
"type": "doc",
},
Object {
"id": "version-1.0.1-foo/baz",
"type": "doc",
},
],
"label": "Test",
"type": "category",
},
Object {
"items": Array [
Object {
"id": "version-1.0.1-hello",
"type": "doc",
},
],
"label": "Guides",
"type": "category",
},
],
}
`;
exports[`loadSidebars site without sidebars 1`] = `Object {}`; exports[`loadSidebars site without sidebars 1`] = `Object {}`;

View file

@ -7,16 +7,15 @@
import '@babel/polyfill'; import '@babel/polyfill';
import path from 'path'; import path from 'path';
import loadSetup from '../../../docusaurus/test/loadSetup'; import loadSetup from '../../../docusaurus/lib/server/load/__tests__/loadSetup';
import DocusaurusPluginContentDocs from '../index'; import DocusaurusPluginContentDocs from '../index';
describe('loadDocs', () => { describe('loadDocs', () => {
test('simple website', async () => { test('simple website', async () => {
const {env, siteDir, siteConfig} = await loadSetup('simple'); const {siteDir, siteConfig} = await loadSetup('simple');
const sidebarPath = path.join(siteDir, 'sidebars.json'); const sidebarPath = path.join(siteDir, 'sidebars.json');
const plugin = new DocusaurusPluginContentDocs( const plugin = new DocusaurusPluginContentDocs(
{ {
env,
siteDir, siteDir,
siteConfig, siteConfig,
}, },
@ -31,229 +30,22 @@ describe('loadDocs', () => {
expect(docsMetadata.hello).toEqual({ expect(docsMetadata.hello).toEqual({
category: 'Guides', category: 'Guides',
id: 'hello', id: 'hello',
language: null,
localized_id: 'hello',
permalink: '/docs/hello', permalink: '/docs/hello',
previous: 'foo/baz', previous: 'foo/baz',
previous_id: 'foo/baz',
previous_title: 'baz', previous_title: 'baz',
sidebar: 'docs', sidebar: 'docs',
source: path.join(docsDir, 'hello.md'), source: path.join(docsDir, 'hello.md'),
title: 'Hello, World !', title: 'Hello, World !',
version: null,
}); });
expect(docsMetadata['foo/bar']).toEqual({ expect(docsMetadata['foo/bar']).toEqual({
category: 'Test', category: 'Test',
id: 'foo/bar', id: 'foo/bar',
language: null,
localized_id: 'foo/bar',
next: 'foo/baz', next: 'foo/baz',
next_id: 'foo/baz',
next_title: 'baz', next_title: 'baz',
permalink: '/docs/foo/bar', permalink: '/docs/foo/bar',
sidebar: 'docs', sidebar: 'docs',
source: path.join(docsDir, 'foo', 'bar.md'), source: path.join(docsDir, 'foo', 'bar.md'),
title: 'Bar', title: 'Bar',
version: null,
}); });
}); });
test('versioned website', async () => {
const {env, siteDir, siteConfig} = await loadSetup('versioned');
const sidebarPath = path.join(siteDir, 'sidebars.json');
const plugin = new DocusaurusPluginContentDocs(
{
env,
siteDir,
siteConfig,
},
{
path: '../docs',
sidebarPath,
},
);
const {docs: docsMetadata, versionedDir} = await plugin.loadContent();
const docsDir = plugin.contentPath;
expect(docsMetadata['version-1.0.0-foo/bar']).toEqual({
category: 'Test',
id: 'version-1.0.0-foo/bar',
language: null,
localized_id: 'version-1.0.0-foo/bar',
next: 'version-1.0.0-foo/baz',
next_id: 'version-1.0.0-foo/baz',
next_title: 'Baz',
permalink: '/docs/1.0.0/foo/bar',
sidebar: 'version-1.0.0-docs',
source: path.join(versionedDir, 'version-1.0.0/foo/bar.md'),
title: 'Bar',
version: '1.0.0',
});
expect(docsMetadata['foo/bar']).toEqual({
category: 'Test',
id: 'foo/bar',
language: null,
localized_id: 'foo/bar',
next: 'foo/baz',
next_id: 'foo/baz',
next_title: 'baz',
permalink: '/docs/next/foo/bar',
sidebar: 'docs',
source: path.join(docsDir, 'foo/bar.md'),
title: 'Bar',
version: 'next',
});
});
test('versioned & translated website', async () => {
const {env, siteDir, siteConfig} = await loadSetup('transversioned');
const sidebarPath = path.join(siteDir, 'sidebars.json');
const plugin = new DocusaurusPluginContentDocs(
{
env,
siteDir,
siteConfig,
},
{
path: '../docs',
sidebarPath,
},
);
const {
docs: docsMetadata,
translatedDir,
versionedDir,
} = await plugin.loadContent();
const docsDir = plugin.contentPath;
expect(docsMetadata['ko-version-1.0.0-foo/bar']).toEqual({
category: 'Test',
id: 'ko-version-1.0.0-foo/bar',
language: 'ko',
localized_id: 'version-1.0.0-foo/bar',
next: 'ko-version-1.0.0-foo/baz',
next_id: 'version-1.0.0-foo/baz',
next_title: 'baz',
permalink: '/docs/ko/1.0.0/foo/bar',
sidebar: 'version-1.0.0-docs',
source: path.join(translatedDir, '/ko/version-1.0.0/foo/bar.md'),
title: 'Bar',
version: '1.0.0',
});
expect(docsMetadata['en-version-1.0.0-foo/baz']).toEqual({
category: 'Test',
id: 'en-version-1.0.0-foo/baz',
language: 'en',
localized_id: 'version-1.0.0-foo/baz',
next: 'en-version-1.0.0-hello',
next_id: 'version-1.0.0-hello',
next_title: 'Hello, World !',
permalink: '/docs/en/1.0.0/foo/baz',
previous: 'en-version-1.0.0-foo/bar',
previous_id: 'version-1.0.0-foo/bar',
previous_title: 'Bar',
sidebar: 'version-1.0.0-docs',
source: path.join(versionedDir, 'version-1.0.0/foo/baz.md'),
title: 'Baz',
version: '1.0.0',
});
expect(docsMetadata['en-hello']).toEqual({
category: 'Guides',
id: 'en-hello',
language: 'en',
localized_id: 'hello',
permalink: '/docs/en/next/hello',
previous: 'en-foo/baz',
previous_id: 'foo/baz',
previous_title: 'baz',
sidebar: 'docs',
source: path.join(docsDir, 'hello.md'),
title: 'Hello, World !',
version: 'next',
});
});
test('translated website', async () => {
const {env, siteDir, siteConfig} = await loadSetup('translated');
const sidebarPath = path.join(siteDir, 'sidebars.json');
const plugin = new DocusaurusPluginContentDocs(
{
env,
siteDir,
siteConfig,
},
{
path: '../docs',
sidebarPath,
},
);
const {docs: docsMetadata, translatedDir} = await plugin.loadContent();
const docsDir = plugin.contentPath;
expect(docsMetadata['ko-foo/baz']).toEqual({
category: 'Test',
id: 'ko-foo/baz',
language: 'ko',
localized_id: 'foo/baz',
next: 'ko-hello',
next_id: 'hello',
next_title: 'Hello, World !',
permalink: '/docs/ko/foo/baz',
previous: 'ko-foo/bar',
previous_id: 'foo/bar',
previous_title: 'Bar',
sidebar: 'docs',
source: path.join(translatedDir, 'ko', 'foo', 'baz.md'),
title: 'baz',
version: null,
});
expect(docsMetadata['en-foo/bar']).toEqual({
category: 'Test',
id: 'en-foo/bar',
language: 'en',
localized_id: 'foo/bar',
next: 'en-foo/baz',
next_id: 'foo/baz',
next_title: 'baz',
permalink: '/docs/en/foo/bar',
sidebar: 'docs',
source: path.join(docsDir, 'foo', 'bar.md'),
title: 'Bar',
version: null,
});
});
test('versioned website with skip next release', async () => {
const {env, siteDir, siteConfig} = await loadSetup('versioned');
const sidebarPath = path.join(siteDir, 'sidebars.json');
const plugin = new DocusaurusPluginContentDocs(
{
env,
siteDir,
siteConfig,
},
{
path: '../docs',
sidebarPath,
skipNextRelease: true,
},
);
const {docs: docsMetadata, versionedDir} = await plugin.loadContent();
expect(docsMetadata['version-1.0.0-foo/bar']).toEqual({
category: 'Test',
id: 'version-1.0.0-foo/bar',
language: null,
localized_id: 'version-1.0.0-foo/bar',
next: 'version-1.0.0-foo/baz',
next_id: 'version-1.0.0-foo/baz',
next_title: 'Baz',
permalink: '/docs/1.0.0/foo/bar',
sidebar: 'version-1.0.0-docs',
source: path.join(versionedDir, 'version-1.0.0/foo/bar.md'),
title: 'Bar',
version: '1.0.0',
});
expect(docsMetadata['foo/bar']).toBeUndefined();
});
}); });

View file

@ -8,19 +8,18 @@
import '@babel/polyfill'; import '@babel/polyfill';
import path from 'path'; import path from 'path';
import processMetadata from '../metadata'; import processMetadata from '../metadata';
import loadSetup from '../../../docusaurus/test/loadSetup'; import loadSetup from '../../../docusaurus/lib/server/load/__tests__/loadSetup';
describe('processMetadata', () => { describe('processMetadata', () => {
test('normal docs', async () => { test('normal docs', async () => {
const props = await loadSetup('simple'); const props = await loadSetup('simple');
const {siteDir, env, siteConfig} = props; const {siteDir, siteConfig} = props;
const docsDir = path.resolve(siteDir, '..', 'docs'); const docsDir = path.resolve(siteDir, '..', 'docs');
const sourceA = path.join('foo', 'bar.md'); const sourceA = path.join('foo', 'bar.md');
const sourceB = path.join('hello.md'); const sourceB = path.join('hello.md');
const dataA = await processMetadata( const dataA = await processMetadata(
sourceA, sourceA,
docsDir, docsDir,
env,
{}, {},
siteConfig, siteConfig,
'docs', 'docs',
@ -28,362 +27,35 @@ describe('processMetadata', () => {
const dataB = await processMetadata( const dataB = await processMetadata(
sourceB, sourceB,
docsDir, docsDir,
env,
{}, {},
siteConfig, siteConfig,
'docs', 'docs',
); );
expect(dataA).toEqual({ expect(dataA).toEqual({
id: 'foo/bar', id: 'foo/bar',
language: null,
localized_id: 'foo/bar',
permalink: '/docs/foo/bar', permalink: '/docs/foo/bar',
source: path.join(docsDir, sourceA), source: path.join(docsDir, sourceA),
title: 'Bar', title: 'Bar',
version: null,
}); });
expect(dataB).toEqual({ expect(dataB).toEqual({
id: 'hello', id: 'hello',
language: null,
localized_id: 'hello',
permalink: '/docs/hello', permalink: '/docs/hello',
source: path.join(docsDir, sourceB), source: path.join(docsDir, sourceB),
title: 'Hello, World !', title: 'Hello, World !',
version: null,
}); });
}); });
test('docs with custom permalink', async () => { test('docs with custom permalink', async () => {
const props = await loadSetup('simple'); const props = await loadSetup('simple');
const {siteDir, env, siteConfig} = props; const {siteDir, siteConfig} = props;
const docsDir = path.resolve(siteDir, '..', 'docs'); const docsDir = path.resolve(siteDir, '..', 'docs');
const source = path.join('permalink.md'); const source = path.join('permalink.md');
const data = await processMetadata( const data = await processMetadata(source, docsDir, {}, siteConfig, 'docs');
source,
docsDir,
env,
{},
siteConfig,
'docs',
);
expect(data).toEqual({ expect(data).toEqual({
id: 'permalink', id: 'permalink',
language: null,
localized_id: 'permalink',
permalink: '/docs/endiliey/permalink', permalink: '/docs/endiliey/permalink',
source: path.join(docsDir, source), source: path.join(docsDir, source),
title: 'Permalink', title: 'Permalink',
version: null,
});
});
test('versioned docs (without translation)', async () => {
const props = await loadSetup('versioned');
const {siteDir, env, siteConfig} = props;
const docsDir = path.resolve(siteDir, '..', 'docs');
const versionedDir = path.join(siteDir, 'versioned_docs');
const sourceA = path.join('version-1.0.0', 'foo', 'bar.md');
const sourceB = path.join('version-1.0.0', 'hello.md');
const sourceC = path.join('foo', 'bar.md');
const sourceD = path.join('hello.md');
const dataA = await processMetadata(
sourceA,
versionedDir,
env,
{},
siteConfig,
'docs',
);
const dataB = await processMetadata(
sourceB,
versionedDir,
env,
{},
siteConfig,
'docs',
);
const dataC = await processMetadata(
sourceC,
docsDir,
env,
{},
siteConfig,
'docs',
);
const dataD = await processMetadata(
sourceD,
docsDir,
env,
{},
siteConfig,
'docs',
);
expect(dataA).toEqual({
id: 'version-1.0.0-foo/bar',
language: null,
localized_id: 'version-1.0.0-foo/bar',
permalink: '/docs/1.0.0/foo/bar',
source: path.join(versionedDir, sourceA),
title: 'Bar',
version: '1.0.0',
});
expect(dataB).toEqual({
id: 'version-1.0.0-hello',
language: null,
localized_id: 'version-1.0.0-hello',
permalink: '/docs/1.0.0/hello',
source: path.join(versionedDir, sourceB),
title: 'Hello, World !',
version: '1.0.0',
});
expect(dataC).toEqual({
id: 'foo/bar',
language: null,
localized_id: 'foo/bar',
permalink: '/docs/next/foo/bar',
source: path.join(docsDir, sourceC),
title: 'Bar',
version: 'next',
});
expect(dataD).toEqual({
id: 'hello',
language: null,
localized_id: 'hello',
permalink: '/docs/next/hello',
source: path.join(docsDir, sourceD),
title: 'Hello, World !',
version: 'next',
});
});
test('translated versioned docs', async () => {
const props = await loadSetup('transversioned');
const {siteDir, env, siteConfig} = props;
const docsDir = path.resolve(siteDir, '..', 'docs');
const versionedDir = path.join(siteDir, 'versioned_docs');
const translatedDir = path.join(siteDir, 'translated_docs');
const sourceA = path.join('ko', 'version-1.0.0', 'foo', 'bar.md');
const sourceB = path.join('ko', 'version-1.0.0', 'hello.md');
const sourceC = path.join('ko', 'version-1.0.1', 'foo', 'bar.md');
const sourceD = path.join('ko', 'version-1.0.1', 'hello.md');
const sourceE = path.join('foo', 'bar.md');
const sourceF = path.join('hello.md');
const sourceG = path.join('version-1.0.0', 'foo', 'bar.md');
const sourceH = path.join('version-1.0.0', 'hello.md');
const dataA = await processMetadata(
sourceA,
translatedDir,
env,
{},
siteConfig,
'docs',
);
const dataB = await processMetadata(
sourceB,
translatedDir,
env,
{},
siteConfig,
'docs',
);
const dataC = await processMetadata(
sourceC,
translatedDir,
env,
{},
siteConfig,
'docs',
);
const dataD = await processMetadata(
sourceD,
translatedDir,
env,
{},
siteConfig,
'docs',
);
const dataE = await processMetadata(
sourceE,
docsDir,
env,
{},
siteConfig,
'docs',
);
const dataF = await processMetadata(
sourceF,
docsDir,
env,
{},
siteConfig,
'docs',
);
const dataG = await processMetadata(
sourceG,
versionedDir,
env,
{},
siteConfig,
'docs',
);
const dataH = await processMetadata(
sourceH,
versionedDir,
env,
{},
siteConfig,
'docs',
);
expect(dataA).toEqual({
id: 'ko-version-1.0.0-foo/bar',
language: 'ko',
localized_id: 'version-1.0.0-foo/bar',
permalink: '/docs/ko/1.0.0/foo/bar',
source: path.join(translatedDir, sourceA),
title: 'Bar',
version: '1.0.0',
});
expect(dataB).toEqual({
id: 'ko-version-1.0.0-hello',
language: 'ko',
localized_id: 'version-1.0.0-hello',
permalink: '/docs/ko/1.0.0/hello',
source: path.join(translatedDir, sourceB),
title: 'Hello, World !',
version: '1.0.0',
});
expect(dataC).toEqual({
id: 'ko-version-1.0.1-foo/bar',
language: 'ko',
localized_id: 'version-1.0.1-foo/bar',
permalink: '/docs/ko/foo/bar',
source: path.join(translatedDir, sourceC),
title: 'Bar',
version: '1.0.1',
});
expect(dataD).toEqual({
id: 'ko-version-1.0.1-hello',
language: 'ko',
localized_id: 'version-1.0.1-hello',
permalink: '/docs/ko/hello',
source: path.join(translatedDir, sourceD),
title: 'Hello, World !',
version: '1.0.1',
});
expect(dataE).toEqual({
id: 'en-foo/bar',
language: 'en',
localized_id: 'foo/bar',
permalink: '/docs/en/next/foo/bar',
source: path.join(docsDir, sourceE),
title: 'Bar',
version: 'next',
});
expect(dataF).toEqual({
id: 'en-hello',
language: 'en',
localized_id: 'hello',
permalink: '/docs/en/next/hello',
source: path.join(docsDir, sourceF),
title: 'Hello, World !',
version: 'next',
});
expect(dataG).toEqual({
id: 'en-version-1.0.0-foo/bar',
language: 'en',
localized_id: 'version-1.0.0-foo/bar',
permalink: '/docs/en/1.0.0/foo/bar',
source: path.join(versionedDir, sourceG),
title: 'Bar',
version: '1.0.0',
});
expect(dataH).toEqual({
id: 'en-version-1.0.0-hello',
language: 'en',
localized_id: 'version-1.0.0-hello',
permalink: '/docs/en/1.0.0/hello',
source: path.join(versionedDir, sourceH),
title: 'Hello, World !',
version: '1.0.0',
});
});
test('translated docs only', async () => {
const props = await loadSetup('translated');
const {siteDir, env, siteConfig} = props;
const docsDir = path.resolve(siteDir, '..', 'docs');
const translatedDir = path.join(siteDir, 'translated_docs');
const sourceA = path.join('ko', 'foo', 'bar.md');
const sourceB = path.join('ko', 'hello.md');
const sourceC = path.join('foo', 'bar.md');
const sourceD = path.join('hello.md');
const dataA = await processMetadata(
sourceA,
translatedDir,
env,
{},
siteConfig,
'docs',
);
const dataB = await processMetadata(
sourceB,
translatedDir,
env,
{},
siteConfig,
'docs',
);
const dataC = await processMetadata(
sourceC,
docsDir,
env,
{},
siteConfig,
'docs',
);
const dataD = await processMetadata(
sourceD,
docsDir,
env,
{},
siteConfig,
'docs',
);
expect(dataA).toEqual({
id: 'ko-foo/bar',
language: 'ko',
localized_id: 'foo/bar',
permalink: '/docs/ko/foo/bar',
source: path.join(translatedDir, sourceA),
title: 'Bar',
version: null,
});
expect(dataB).toEqual({
id: 'ko-hello',
language: 'ko',
localized_id: 'hello',
permalink: '/docs/ko/hello',
source: path.join(translatedDir, sourceB),
title: 'Hello, World !',
version: null,
});
expect(dataC).toEqual({
id: 'en-foo/bar',
language: 'en',
localized_id: 'foo/bar',
permalink: '/docs/en/foo/bar',
source: path.join(docsDir, sourceC),
title: 'Bar',
version: null,
});
expect(dataD).toEqual({
id: 'en-hello',
language: 'en',
localized_id: 'hello',
permalink: '/docs/en/hello',
source: path.join(docsDir, sourceD),
title: 'Hello, World !',
version: null,
}); });
}); });
}); });

View file

@ -7,7 +7,7 @@
import path from 'path'; import path from 'path';
import loadSidebars from '../sidebars'; import loadSidebars from '../sidebars';
import loadSetup from '../../../docusaurus/test/loadSetup'; import loadSetup from '../../../docusaurus/lib/server/load/__tests__/loadSetup';
/* eslint-disable global-require, import/no-dynamic-require */ /* eslint-disable global-require, import/no-dynamic-require */
@ -15,38 +15,15 @@ describe('loadSidebars', () => {
const fixtures = path.join(__dirname, '..', '__fixtures__'); const fixtures = path.join(__dirname, '..', '__fixtures__');
test('normal site with sidebars', async () => { test('normal site with sidebars', async () => {
const {env, siteDir} = await loadSetup('simple'); const {siteDir} = await loadSetup('simple');
const sidebar = require(path.join(siteDir, 'sidebars.json')); const sidebar = require(path.join(siteDir, 'sidebars.json'));
const result = loadSidebars({siteDir, env, sidebar}); const result = loadSidebars({siteDir, sidebar});
expect(result).toMatchSnapshot(); expect(result).toMatchSnapshot();
}); });
test('site without sidebars', () => { test('site without sidebars', () => {
const env = {};
const siteDir = path.join(fixtures, 'bad-site'); const siteDir = path.join(fixtures, 'bad-site');
const result = loadSidebars({siteDir, env, sidebar: {}}); const result = loadSidebars({siteDir, sidebar: {}});
expect(result).toMatchSnapshot(); expect(result).toMatchSnapshot();
}); });
test('site with sidebars & versioned sidebars', async () => {
const {env, siteDir} = await loadSetup('versioned');
const sidebar = require(path.join(siteDir, 'sidebars.json'));
const result = loadSidebars({siteDir, env, sidebar});
expect(result).toMatchSnapshot();
});
test('site with missing versioned sidebars', async () => {
const env = {
versioning: {
enabled: true,
versions: ['2.0.0'],
},
};
const {siteDir} = await loadSetup('versioned');
expect(() => {
loadSidebars({siteDir, env, sidebar: {}});
}).toThrowErrorMatchingInlineSnapshot(
`"Failed to load versioned_sidebars/version-2.0.0-sidebars.json. It does not exist."`,
);
});
}); });

View file

@ -8,12 +8,7 @@
const globby = require('globby'); const globby = require('globby');
const importFresh = require('import-fresh'); const importFresh = require('import-fresh');
const path = require('path'); const path = require('path');
const { const {idx, normalizeUrl, docuHash} = require('@docusaurus/utils');
getSubFolder,
idx,
normalizeUrl,
docuHash,
} = require('@docusaurus/utils');
const createOrder = require('./order'); const createOrder = require('./order');
const loadSidebars = require('./sidebars'); const loadSidebars = require('./sidebars');
@ -28,7 +23,6 @@ const DEFAULT_OPTIONS = {
// TODO: Settle themeing. // TODO: Settle themeing.
docLayoutComponent: '@theme/Doc', docLayoutComponent: '@theme/Doc',
docItemComponent: '@theme/DocBody', docItemComponent: '@theme/DocBody',
skipNextRelease: false, // Skip documents from next release (default = false)
}; };
class DocusaurusPluginContentDocs { class DocusaurusPluginContentDocs {
@ -53,123 +47,36 @@ class DocusaurusPluginContentDocs {
// Fetches blog contents and returns metadata for the contents. // Fetches blog contents and returns metadata for the contents.
async loadContent() { async loadContent() {
const {include, routeBasePath, sidebarPath, skipNextRelease} = this.options; const {include, routeBasePath, sidebarPath} = this.options;
const {siteDir, env, siteConfig} = this.context; const {siteDir, siteConfig} = this.context;
const docsDir = this.contentPath; const docsDir = this.contentPath;
// We don't want sidebars to be cached because of hotreloading. // We don't want sidebars to be cached because of hotreloading.
const sidebar = importFresh(sidebarPath); const sidebar = importFresh(sidebarPath);
const docsSidebars = loadSidebars({siteDir, env, sidebar}); const docsSidebars = loadSidebars({siteDir, sidebar});
// @tested - build the docs ordering such as next, previous, category and sidebar // @tested - build the docs ordering such as next, previous, category and sidebar
const order = createOrder(docsSidebars); const order = createOrder(docsSidebars);
// Settle versions & translations from environment.
const translationEnabled = idx(env, ['translation', 'enabled']);
const enabledLanguages =
translationEnabled && idx(env, ['translation', 'enabledLanguages']);
const enabledLangTags =
(enabledLanguages && enabledLanguages.map(lang => lang.tag)) || [];
const defaultLangTag = idx(env, ['translation', 'defaultLanguage', 'tag']);
const versioningEnabled = idx(env, ['versioning', 'enabled']);
const versions =
(versioningEnabled && idx(env, ['versioning', 'versions'])) || [];
// Prepare metadata container. // Prepare metadata container.
const docs = {}; const docs = {};
if (!(versioningEnabled && skipNextRelease)) { // Metadata for default docs files.
// Metadata for default docs files. const docsFiles = await globby(include, {
const docsFiles = await globby(include, { cwd: docsDir,
cwd: docsDir, });
}); await Promise.all(
await Promise.all( docsFiles.map(async source => {
docsFiles.map(async source => { const metadata = await processMetadata(
// Do not allow reserved version/ translated folder name in 'docs' source,
// e.g: 'docs/version-1.0.0/' should not be allowed as it can cause unwanted bug docsDir,
const subFolder = getSubFolder( order,
path.resolve(docsDir, source), siteConfig,
docsDir, routeBasePath,
); );
const versionsFolders = versions.map(version => `version-${version}`); docs[metadata.id] = metadata;
if ([...enabledLangTags, ...versionsFolders].includes(subFolder)) { }),
throw new Error( );
`You cannot have a folder named 'docs/${subFolder}/'`,
);
}
const metadata = await processMetadata(
source,
docsDir,
env,
order,
siteConfig,
routeBasePath,
);
docs[metadata.id] = metadata;
}),
);
}
// Metadata for non-default-language docs.
let translatedDir = null;
if (translationEnabled) {
translatedDir = path.join(siteDir, 'translated_docs');
const translatedFiles = await globby(include, {
cwd: translatedDir,
});
await Promise.all(
translatedFiles.map(async source => {
/*
Do not process disabled & default languages folder in `translated_docs`
e.g: 'translated_docs/ja/**' should not be processed if lang 'ja' is disabled
*/
const translatedFilePath = path.resolve(translatedDir, source);
const detectedLangTag = getSubFolder(
translatedFilePath,
translatedDir,
);
if (
detectedLangTag === defaultLangTag ||
!enabledLangTags.includes(detectedLangTag)
) {
return;
}
const metadata = await processMetadata(
source,
translatedDir,
env,
order,
siteConfig,
routeBasePath,
);
docs[metadata.id] = metadata;
}),
);
}
// Metadata for versioned docs.
let versionedDir = null;
if (versioningEnabled) {
versionedDir = path.join(siteDir, 'versioned_docs');
const versionedFiles = await globby(include, {
cwd: versionedDir,
});
await Promise.all(
versionedFiles.map(async source => {
const metadata = await processMetadata(
source,
versionedDir,
env,
order,
siteConfig,
routeBasePath,
);
docs[metadata.id] = metadata;
}),
);
}
// Get the titles of the previous and next ids so that we can use them. // Get the titles of the previous and next ids so that we can use them.
Object.keys(docs).forEach(currentID => { Object.keys(docs).forEach(currentID => {
@ -185,28 +92,19 @@ class DocusaurusPluginContentDocs {
} }
}); });
const sourceToMetadata = {}; const sourceToPermalink = {};
const permalinkToId = {}; const permalinkToId = {};
Object.values(docs).forEach( Object.values(docs).forEach(({id, source, permalink}) => {
({id, source, version, permalink, language}) => { sourceToPermalink[source] = permalink;
sourceToMetadata[source] = { permalinkToId[permalink] = id;
version, });
permalink,
language,
};
permalinkToId[permalink] = id;
},
);
this.content = { this.content = {
docs, docs,
docsDir, docsDir,
docsSidebars, docsSidebars,
sourceToMetadata, sourceToPermalink,
permalinkToId, permalinkToId,
translatedDir,
versionedDir,
}; };
return this.content; return this.content;
@ -254,9 +152,6 @@ class DocusaurusPluginContentDocs {
} }
configureWebpack(config, isServer, {getBabelLoader, getCacheLoader}) { configureWebpack(config, isServer, {getBabelLoader, getCacheLoader}) {
const versionedDir = path.join(this.context.siteDir, 'versioned_docs');
const translatedDir = path.join(this.context.siteDir, 'translated_docs');
return { return {
module: { module: {
rules: [ rules: [
@ -271,10 +166,8 @@ class DocusaurusPluginContentDocs {
loader: path.resolve(__dirname, './markdown/index.js'), loader: path.resolve(__dirname, './markdown/index.js'),
options: { options: {
siteConfig: this.context.siteConfig, siteConfig: this.context.siteConfig,
versionedDir,
translatedDir,
docsDir: this.content.docsDir, docsDir: this.content.docsDir,
sourceToMetadata: this.content.sourceToMetadata, sourceToPermalink: this.content.sourceToPermalink,
}, },
}, },
], ],

View file

@ -7,7 +7,6 @@
const fm = require('front-matter'); const fm = require('front-matter');
const {getOptions} = require('loader-utils'); const {getOptions} = require('loader-utils');
const path = require('path');
const {resolve} = require('url'); const {resolve} = require('url');
module.exports = async function(fileString) { module.exports = async function(fileString) {
@ -15,7 +14,7 @@ module.exports = async function(fileString) {
const options = Object.assign({}, getOptions(this), { const options = Object.assign({}, getOptions(this), {
filepath: this.resourcePath, filepath: this.resourcePath,
}); });
const {versionedDir, docsDir, translatedDir, sourceToMetadata} = options; const {docsDir, sourceToPermalink} = options;
// Extract content of markdown (without frontmatter). // Extract content of markdown (without frontmatter).
const {body} = fm(fileString); const {body} = fm(fileString);
@ -23,19 +22,7 @@ module.exports = async function(fileString) {
// Determine the source dir. e.g: /docs, /website/versioned_docs/version-1.0.0 // Determine the source dir. e.g: /docs, /website/versioned_docs/version-1.0.0
let sourceDir; let sourceDir;
const thisSource = this.resourcePath; const thisSource = this.resourcePath;
if (thisSource.startsWith(translatedDir)) { if (thisSource.startsWith(docsDir)) {
const {language, version} = sourceToMetadata[thisSource] || {};
if (language && version && version !== 'next') {
sourceDir = path.join(translatedDir, language, `version-${version}`);
} else if (language && (!version || version === 'next')) {
sourceDir = path.join(translatedDir, language);
}
} else if (thisSource.startsWith(versionedDir)) {
const {version} = sourceToMetadata[thisSource] || {};
if (version) {
sourceDir = path.join(versionedDir, `version-${version}`);
}
} else if (thisSource.startsWith(docsDir)) {
sourceDir = docsDir; sourceDir = docsDir;
} }
@ -59,10 +46,9 @@ module.exports = async function(fileString) {
// Replace it to correct html link. // Replace it to correct html link.
const mdLink = mdMatch[1]; const mdLink = mdMatch[1];
const targetSource = `${sourceDir}/${mdLink}`; const targetSource = `${sourceDir}/${mdLink}`;
const {permalink} = const permalink =
sourceToMetadata[resolve(thisSource, mdLink)] || sourceToPermalink[resolve(thisSource, mdLink)] ||
sourceToMetadata[targetSource] || sourceToPermalink[targetSource];
{};
if (permalink) { if (permalink) {
modifiedLine = modifiedLine.replace(mdLink, permalink); modifiedLine = modifiedLine.replace(mdLink, permalink);
} }

View file

@ -7,53 +7,11 @@
const fs = require('fs-extra'); const fs = require('fs-extra');
const path = require('path'); const path = require('path');
const {getSubFolder, idx, parse, normalizeUrl} = require('@docusaurus/utils'); const {parse, normalizeUrl} = require('@docusaurus/utils');
function getLanguage(filepath, refDir, env) {
const translationEnabled = idx(env, ['translation', 'enabled']);
if (translationEnabled) {
const detectedLangTag = getSubFolder(filepath, refDir);
const enabledLanguages = idx(env, ['translation', 'enabledLanguages']);
const langTags =
(enabledLanguages && enabledLanguages.map(lang => lang.tag)) || [];
if (langTags.includes(detectedLangTag)) {
return detectedLangTag;
}
const defaultLanguage = idx(env, ['translation', 'defaultLanguage']);
if (defaultLanguage && defaultLanguage.tag) {
return defaultLanguage.tag;
}
}
return null;
}
function getVersion(filepath, refDir, env) {
const versioningEnabled = idx(env, ['versioning', 'enabled']);
if (versioningEnabled) {
const subFolder = getSubFolder(filepath, refDir);
if (subFolder) {
const detectedVersion = subFolder.replace(/^version-/, '');
const versions = idx(env, ['versioning', 'versions']) || [];
if (versions.includes(detectedVersion)) {
return detectedVersion;
}
}
return 'next';
}
return null;
}
module.exports = async function processMetadata( module.exports = async function processMetadata(
source, source,
refDir, refDir,
env,
order, order,
siteConfig, siteConfig,
docsBasePath, docsBasePath,
@ -75,44 +33,9 @@ module.exports = async function processMetadata(
metadata.title = metadata.id; metadata.title = metadata.id;
} }
// Language.
const language = getLanguage(filepath, refDir, env);
metadata.language = language;
const langPart = (language && `${language}/`) || '';
// Version.
const defaultLangTag = idx(env, ['translation', 'defaultLanguage', 'tag']);
let versionRefDir = refDir;
if (language && language !== defaultLangTag) {
versionRefDir = path.join(refDir, language);
}
const version = getVersion(filepath, versionRefDir, env);
metadata.version = version;
const latestVersion = idx(env, ['versioning', 'latestVersion']);
const versionPart =
(version && version !== latestVersion && `${version}/`) || '';
// Convert temporarily metadata.id to the form of dirname/id without version/lang prefix.
// e.g.: file `versioned_docs/version-1.0.0/en/foo/bar.md` with id `version-1.0.0-bar` => `foo/bar`
if (language) {
metadata.id = metadata.id.replace(new RegExp(`^${language}-`), '');
}
if (version) {
metadata.id = metadata.id.replace(new RegExp(`^version-${version}-`), '');
}
const dirName = path.dirname(source); const dirName = path.dirname(source);
if (dirName !== '.') { if (dirName !== '.') {
let prefix = dirName; const prefix = dirName;
if (language) {
prefix = prefix.replace(new RegExp(`^${language}`), '');
}
prefix = prefix.replace(/^\//, '');
if (version) {
prefix = prefix.replace(new RegExp(`^version-${version}`), '');
}
prefix = prefix.replace(/^\//, '');
if (prefix) { if (prefix) {
metadata.id = `${prefix}/${metadata.id}`; metadata.id = `${prefix}/${metadata.id}`;
} }
@ -132,46 +55,23 @@ module.exports = async function processMetadata(
metadata.permalink metadata.permalink
.replace(/:baseUrl/, baseUrl) .replace(/:baseUrl/, baseUrl)
.replace(/:docsUrl/, docsBasePath) .replace(/:docsUrl/, docsBasePath)
.replace(/:langPart/, langPart)
.replace(/:versionPart/, versionPart)
.replace(/:id/, metadata.id), .replace(/:id/, metadata.id),
); );
} else { } else {
metadata.permalink = normalizeUrl([ metadata.permalink = normalizeUrl([baseUrl, docsBasePath, metadata.id]);
baseUrl,
docsBasePath,
langPart,
versionPart,
metadata.id,
]);
}
// If version.
if (version && version !== 'next') {
metadata.id = `version-${version}-${metadata.id}`;
}
// Save localized id before adding language on it.
metadata.localized_id = metadata.id;
// If language.
if (language) {
metadata.id = `${language}-${metadata.id}`;
} }
// Determine order. // Determine order.
const id = metadata.localized_id; const {id} = metadata;
if (order[id]) { if (order[id]) {
metadata.sidebar = order[id].sidebar; metadata.sidebar = order[id].sidebar;
metadata.category = order[id].category; metadata.category = order[id].category;
metadata.subCategory = order[id].subCategory; metadata.subCategory = order[id].subCategory;
if (order[id].next) { if (order[id].next) {
metadata.next_id = order[id].next; metadata.next = order[id].next;
metadata.next = (language ? `${language}-` : '') + order[id].next;
} }
if (order[id].previous) { if (order[id].previous) {
metadata.previous_id = order[id].previous; metadata.previous = order[id].previous;
metadata.previous = (language ? `${language}-` : '') + order[id].previous;
} }
} }

View file

@ -5,10 +5,6 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
const fs = require('fs-extra');
const path = require('path');
const {idx} = require('@docusaurus/utils');
/** /**
* Check that item contains only allowed keys * Check that item contains only allowed keys
* *
@ -113,29 +109,7 @@ function normalizeSidebar(sidebars) {
}, {}); }, {});
} }
module.exports = function loadSidebars({siteDir, env, sidebar}) { module.exports = function loadSidebars({sidebar}) {
const allSidebars = sidebar; const allSidebars = sidebar;
// Versioned sidebars.
if (idx(env, ['versioning', 'enabled'])) {
const versions = idx(env, ['versioning', 'versions']);
if (Array.isArray(versions)) {
versions.forEach(version => {
const versionedSidebarsJSONFile = path.join(
siteDir,
'versioned_sidebars',
`version-${version}-sidebars.json`,
);
if (fs.existsSync(versionedSidebarsJSONFile)) {
const sidebar = require(versionedSidebarsJSONFile); // eslint-disable-line
Object.assign(allSidebars, sidebar);
} else {
const missingFile = path.relative(siteDir, versionedSidebarsJSONFile);
throw new Error(`Failed to load ${missingFile}. It does not exist.`);
}
});
}
}
return normalizeSidebar(allSidebars); return normalizeSidebar(allSidebars);
}; };

View file

@ -7,7 +7,7 @@
import path from 'path'; import path from 'path';
import loadSetup from '../../../docusaurus/test/loadSetup'; import loadSetup from '../../../docusaurus/lib/server/load/__tests__/loadSetup';
import DocusaurusPluginContentPages from '../index'; import DocusaurusPluginContentPages from '../index';
describe('docusaurus-plugin-content-pages', () => { describe('docusaurus-plugin-content-pages', () => {
@ -26,93 +26,9 @@ describe('docusaurus-plugin-content-pages', () => {
}, },
], ],
], ],
[
'versioned',
pagesDir => [
{
permalink: '/',
source: path.join(pagesDir, 'index.js'),
},
{
permalink: '/hello/world',
source: path.join(pagesDir, 'hello', 'world.js'),
},
],
],
[
'translated',
pagesDir => [
{
language: 'en',
permalink: '/',
source: path.join(pagesDir, 'index.js'),
},
{
language: 'en',
permalink: '/en/',
source: path.join(pagesDir, 'index.js'),
},
{
language: 'ko',
permalink: '/ko/',
source: path.join(pagesDir, 'index.js'),
},
{
language: 'en',
permalink: '/hello/world',
source: path.join(pagesDir, 'hello', 'world.js'),
},
{
language: 'en',
permalink: '/en/hello/world',
source: path.join(pagesDir, 'hello', 'world.js'),
},
{
language: 'ko',
permalink: '/ko/hello/world',
source: path.join(pagesDir, 'hello', 'world.js'),
},
],
[
'transversioned',
pagesDir => [
{
language: 'en',
permalink: '/',
source: path.join(pagesDir, 'index.js'),
},
{
language: 'en',
permalink: '/en/',
source: path.join(pagesDir, 'index.js'),
},
{
language: 'ko',
permalink: '/ko/',
source: path.join(pagesDir, 'index.js'),
},
{
language: 'en',
permalink: '/hello/world',
source: path.join(pagesDir, 'hello', 'world.js'),
},
{
language: 'en',
permalink: '/en/hello/world',
source: path.join(pagesDir, 'hello', 'world.js'),
},
{
language: 'ko',
permalink: '/ko/hello/world',
source: path.join(pagesDir, 'hello', 'world.js'),
},
],
],
],
])('%s website', async (type, expected) => { ])('%s website', async (type, expected) => {
const {env, siteDir, siteConfig} = await loadSetup(type); const {siteDir, siteConfig} = await loadSetup(type);
const plugin = new DocusaurusPluginContentPages({ const plugin = new DocusaurusPluginContentPages({
env,
siteDir, siteDir,
siteConfig, siteConfig,
}); });

View file

@ -7,7 +7,7 @@
const globby = require('globby'); const globby = require('globby');
const path = require('path'); const path = require('path');
const {encodePath, fileToPath, idx, docuHash} = require('@docusaurus/utils'); const {encodePath, fileToPath, docuHash} = require('@docusaurus/utils');
const DEFAULT_OPTIONS = { const DEFAULT_OPTIONS = {
path: 'pages', // Path to data on filesystem, relative to site dir. path: 'pages', // Path to data on filesystem, relative to site dir.
@ -37,7 +37,7 @@ class DocusaurusPluginContentPages {
async loadContent() { async loadContent() {
const {include} = this.options; const {include} = this.options;
const {env, siteConfig} = this.context; const {siteConfig} = this.context;
const pagesDir = this.contentPath; const pagesDir = this.contentPath;
const {baseUrl} = siteConfig; const {baseUrl} = siteConfig;
@ -48,44 +48,16 @@ class DocusaurusPluginContentPages {
// Prepare metadata container. // Prepare metadata container.
const pagesMetadatas = []; const pagesMetadatas = [];
// Translation.
const translationEnabled = idx(env, ['translation', 'enabled']);
const enabledLanguages =
translationEnabled && idx(env, ['translation', 'enabledLanguages']);
const enabledLangTags =
(enabledLanguages && enabledLanguages.map(lang => lang.tag)) || [];
const defaultLangTag = idx(env, ['translation', 'defaultLanguage', 'tag']);
await Promise.all( await Promise.all(
pagesFiles.map(async relativeSource => { pagesFiles.map(async relativeSource => {
const source = path.join(pagesDir, relativeSource); const source = path.join(pagesDir, relativeSource);
const pathName = encodePath(fileToPath(relativeSource)); const pathName = encodePath(fileToPath(relativeSource));
if (translationEnabled && enabledLangTags.length > 0) { // Default Language.
enabledLangTags.forEach(langTag => { const metadata = {
// Default lang should also be available. E.g: /en/users and /users is the same. permalink: pathName.replace(/^\//, baseUrl),
if (langTag === defaultLangTag) { source,
pagesMetadatas.push({ };
permalink: pathName.replace(/^\//, baseUrl), pagesMetadatas.push(metadata);
language: langTag,
source,
});
}
const metadata = {
permalink: pathName.replace(/^\//, `${baseUrl}${langTag}/`),
language: langTag,
source,
};
pagesMetadatas.push(metadata);
});
} else {
// Default Language.
const metadata = {
permalink: pathName.replace(/^\//, baseUrl),
source,
};
pagesMetadatas.push(metadata);
}
}), }),
); );

View file

@ -5,22 +5,19 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import loadSetup from '../../../docusaurus/test/loadSetup'; import loadSetup from '../../../docusaurus/lib/server/load/__tests__/loadSetup';
import DocusaurusPluginSitemap from '../index'; import DocusaurusPluginSitemap from '../index';
describe('docusaurus-plugin-sitemap', () => { describe('docusaurus-plugin-sitemap', () => {
describe('createSitemap', () => { describe('createSitemap', () => {
test.each(['simple', 'versioned', 'translated', 'transversioned'])( test.each(['simple'])('%s website', async type => {
'%s website', const context = await loadSetup(type);
async type => { const plugin = new DocusaurusPluginSitemap(context, null);
const context = await loadSetup(type); const sitemap = await plugin.createSitemap(context);
const plugin = new DocusaurusPluginSitemap(context, null); expect(sitemap).toContain(
const sitemap = await plugin.createSitemap(context); `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">`,
expect(sitemap).toContain( );
`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">`, });
);
},
);
test('empty site', async () => { test('empty site', async () => {
const context = await loadSetup('empty'); const context = await loadSetup('empty');

View file

@ -113,7 +113,7 @@ describe('load utils', () => {
test('idx', () => { test('idx', () => {
const a = {}; const a = {};
const b = {hello: 'world'}; const b = {hello: 'world'};
const env = { const obj = {
translation: { translation: {
enabled: true, enabled: true,
enabledLanguages: [ enabledLanguages: [
@ -139,13 +139,13 @@ describe('load utils', () => {
expect(idx(a, [('b', 'c')])).toBeUndefined(); expect(idx(a, [('b', 'c')])).toBeUndefined();
expect(idx(b, ['hello'])).toEqual('world'); expect(idx(b, ['hello'])).toEqual('world');
expect(idx(b, 'hello')).toEqual('world'); expect(idx(b, 'hello')).toEqual('world');
expect(idx(env, 'typo')).toBeUndefined(); expect(idx(obj, 'typo')).toBeUndefined();
expect(idx(env, 'versioning')).toEqual({ expect(idx(obj, 'versioning')).toEqual({
enabled: false, enabled: false,
versions: [], versions: [],
}); });
expect(idx(env, ['translation', 'enabled'])).toEqual(true); expect(idx(obj, ['translation', 'enabled'])).toEqual(true);
expect(idx(env, ['translation', variable]).map(lang => lang.tag)).toEqual([ expect(idx(obj, ['translation', variable]).map(lang => lang.tag)).toEqual([
'en', 'en',
'ja', 'ja',
]); ]);

View file

@ -10,7 +10,6 @@ import {renderRoutes} from 'react-router-config';
import Head from '@docusaurus/Head'; // eslint-disable-line import Head from '@docusaurus/Head'; // eslint-disable-line
import routes from '@generated/routes'; // eslint-disable-line import routes from '@generated/routes'; // eslint-disable-line
import env from '@generated/env'; // eslint-disable-line
import siteConfig from '@generated/docusaurus.config'; //eslint-disable-line import siteConfig from '@generated/docusaurus.config'; //eslint-disable-line
import DocusaurusContext from '@docusaurus/context'; // eslint-disable-line import DocusaurusContext from '@docusaurus/context'; // eslint-disable-line
import PendingNavigation from './PendingNavigation'; import PendingNavigation from './PendingNavigation';
@ -18,8 +17,7 @@ import PendingNavigation from './PendingNavigation';
function App() { function App() {
const [context, setContext] = useState({}); const [context, setContext] = useState({});
return ( return (
<DocusaurusContext.Provider <DocusaurusContext.Provider value={{siteConfig, ...context, setContext}}>
value={{siteConfig, env, ...context, setContext}}>
{/* TODO: this link stylesheet to infima is temporary */} {/* TODO: this link stylesheet to infima is temporary */}
<Head> <Head>
<link <link

View file

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import flat from '@lib/client/flat'; import flat from '../flat';
describe('flat', () => { describe('flat', () => {
test('nested', () => { test('nested', () => {

View file

@ -7,30 +7,17 @@
import React from 'react'; import React from 'react';
import Head from '@docusaurus/Head';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; // eslint-disable-line
import Footer from '@theme/Footer'; // eslint-disable-line
import Layout from '@theme/Layout'; // eslint-disable-line import Layout from '@theme/Layout'; // eslint-disable-line
import Post from '../Post'; import Post from '../Post';
function BlogPage(props) { function BlogPage(props) {
const context = useDocusaurusContext();
const {language, siteConfig = {}} = context;
const {baseUrl, favicon} = siteConfig;
const { const {
metadata: {posts = []}, metadata: {posts = []},
entries: BlogPosts, entries: BlogPosts,
} = props; } = props;
return ( return (
<Layout> <Layout title="Blog">
<Head>
<title>Blog</title>
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
{language && <html lang={language} />}
{language && <meta name="docsearch:language" content={language} />}
</Head>
<div className="container margin-vert--xl"> <div className="container margin-vert--xl">
<div className="row"> <div className="row">
<div className="col col--6 col--offset-3"> <div className="col col--6 col--offset-3">
@ -44,7 +31,6 @@ function BlogPage(props) {
</div> </div>
</div> </div>
</div> </div>
<Footer />
</Layout> </Layout>
); );
} }

View file

@ -7,31 +7,14 @@
import React from 'react'; import React from 'react';
import Head from '@docusaurus/Head';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; // eslint-disable-line
import Layout from '@theme/Layout'; // eslint-disable-line import Layout from '@theme/Layout'; // eslint-disable-line
import Footer from '@theme/Footer'; // eslint-disable-line
import Post from '../Post'; import Post from '../Post';
function BlogPost(props) { function BlogPost(props) {
const {
metadata: contextMetadata = {},
siteConfig = {},
} = useDocusaurusContext();
const {baseUrl, favicon} = siteConfig;
const {language, title} = contextMetadata;
const {content, metadata} = props; const {content, metadata} = props;
const BlogPostContents = content; const BlogPostContents = content;
return ( return (
<Layout> <Layout title={metadata.title}>
<Head defaultTitle={siteConfig.title}>
{title && <title>{title}</title>}
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
{language && <html lang={language} />}
</Head>
{BlogPostContents && ( {BlogPostContents && (
<div className="container margin-vert--xl"> <div className="container margin-vert--xl">
<div className="row"> <div className="row">
@ -43,7 +26,6 @@ function BlogPost(props) {
</div> </div>
</div> </div>
)} )}
<Footer />
</Layout> </Layout>
); );
} }

View file

@ -8,24 +8,13 @@
import React from 'react'; import React from 'react';
import {renderRoutes} from 'react-router-config'; import {renderRoutes} from 'react-router-config';
import Head from '@docusaurus/Head';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; // eslint-disable-line
import Layout from '@theme/Layout'; // eslint-disable-line import Layout from '@theme/Layout'; // eslint-disable-line
import Footer from '@theme/Footer'; // eslint-disable-line
import Navbar from '@theme/Navbar'; // eslint-disable-line
import Sidebar from '@theme/Sidebar'; // eslint-disable-line import Sidebar from '@theme/Sidebar'; // eslint-disable-line
function Doc(props) { function Doc(props) {
const {siteConfig = {}} = useDocusaurusContext();
const {route, docsMetadata, location} = props; const {route, docsMetadata, location} = props;
const {baseUrl, favicon} = siteConfig;
return ( return (
<Layout> <Layout noFooter>
<Head>
<title>{siteConfig.title}</title>
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
</Head>
<div className="container container--fluid"> <div className="container container--fluid">
<div className="row"> <div className="row">
<div className="col col--3"> <div className="col col--3">

View file

@ -29,17 +29,11 @@ const Headings = ({headings, isChild}) => {
}; };
function DocBody(props) { function DocBody(props) {
const {metadata, content, docsMetadata} = props; const {metadata, content: DocContent, docsMetadata} = props;
const {language, version} = metadata;
const DocContents = content;
return ( return (
<div className={styles.docBody}> <div className={styles.docBody}>
<Head> <Head>
{metadata && metadata.title && <title>{metadata.title}</title>} {metadata && metadata.title && <title>{metadata.title}</title>}
{language && <html lang={language} />}
{language && <meta name="docsearch:language" content={language} />}
{version && <meta name="docsearch:version" content={version} />}
</Head> </Head>
<div className="container margin-vert--lg"> <div className="container margin-vert--lg">
<div className="row"> <div className="row">
@ -49,7 +43,7 @@ function DocBody(props) {
</header> </header>
<article> <article>
<div className="markdown"> <div className="markdown">
<DocContents /> <DocContent />
</div> </div>
</article> </article>
<div className="margin-vert--lg"> <div className="margin-vert--lg">
@ -57,7 +51,7 @@ function DocBody(props) {
</div> </div>
</div> </div>
<div className="col col--3 col--offset-1"> <div className="col col--3 col--offset-1">
{content.rightToc && <Headings headings={content.rightToc} />} {DocContent.rightToc && <Headings headings={DocContent.rightToc} />}
</div> </div>
</div> </div>
</div> </div>

View file

@ -6,16 +6,28 @@
*/ */
import React from 'react'; import React from 'react';
import Head from '@docusaurus/Head'; // eslint-disable-line
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; // eslint-disable-line
import Navbar from '@theme/Navbar'; // eslint-disable-line import Navbar from '@theme/Navbar'; // eslint-disable-line
import Footer from '@theme/Footer'; // eslint-disable-line
import './styles.css'; import './styles.css';
function Layout({children}) { function Layout(props) {
const context = useDocusaurusContext();
const {siteConfig = {}} = context;
const {baseUrl, favicon, tagline, title: defaultTitle} = siteConfig;
const {children, title, noFooter} = props;
return ( return (
<div> <React.Fragment>
<Head defaultTitle={`${defaultTitle} · ${tagline}`}>
{title && <title>{title}</title>}
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
</Head>
<Navbar /> <Navbar />
{children} {children}
</div> {!noFooter && <Footer />}
</React.Fragment>
); );
} }

View file

@ -1,46 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Head from '@docusaurus/Head';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
function Markdown(props) {
const context = useDocusaurusContext();
const {siteConfig} = context;
const highlight = Object.assign(
{},
{
version: '9.12.0',
theme: 'atom-one-dark',
},
siteConfig.highlight,
);
// Use user-provided themeUrl if it exists, else construct one from version and theme.
const highlightThemeURL = highlight.themeUrl
? highlight.themeUrl
: `https://cdnjs.cloudflare.com/ajax/libs/highlight.js/${
highlight.version
}/styles/${highlight.theme}.min.css`;
return (
<div>
<Head>
<link rel="stylesheet" type="text/css" href={highlightThemeURL} />
</Head>
<div>{props.children}</div>
</div>
);
}
Markdown.defaultProps = {
siteConfig: {},
};
export default Markdown;

View file

@ -14,7 +14,7 @@ import Search from '@theme/Search';
function Navbar(props) { function Navbar(props) {
const context = useDocusaurusContext(); const context = useDocusaurusContext();
const {siteConfig = {}, env = {}, metadata = {}} = context; const {siteConfig = {}} = context;
// TODO: navbar headerlinks should depends on theme, not siteConfig; // TODO: navbar headerlinks should depends on theme, not siteConfig;
const { const {
baseUrl, baseUrl,
@ -25,12 +25,6 @@ function Navbar(props) {
disableHeaderTitle, disableHeaderTitle,
} = siteConfig; } = siteConfig;
const {language: thisLanguage, version: thisVersion} = metadata;
const translationEnabled = env.translation.enabled;
const versioningEnabled = env.versioning.enabled;
const defaultVersion = versioningEnabled && env.versioning.defaultVersion;
// function to generate each header link // function to generate each header link
const makeLinks = link => { const makeLinks = link => {
if (link.url) { if (link.url) {
@ -64,9 +58,7 @@ function Navbar(props) {
<nav className="navbar navbar--light navbar--fixed-top"> <nav className="navbar navbar--light navbar--fixed-top">
<div className="navbar__inner"> <div className="navbar__inner">
<div className="navbar__items"> <div className="navbar__items">
<Link <Link className="navbar__brand" to={baseUrl}>
className="navbar__brand"
to={baseUrl + (translationEnabled ? thisLanguage : '')}>
{headerIcon && ( {headerIcon && (
<img <img
className="navbar__logo" className="navbar__logo"
@ -76,18 +68,6 @@ function Navbar(props) {
)} )}
{!disableHeaderTitle && <strong>{title}</strong>} {!disableHeaderTitle && <strong>{title}</strong>}
</Link> </Link>
{versioningEnabled && (
<div key="versions" className="navbar__item">
<Link
className="navbar__link"
to={
baseUrl +
(translationEnabled ? `${thisLanguage}/versions` : `versions`)
}>
{thisVersion || defaultVersion}
</Link>
</div>
)}
{headerLinks.map(makeLinks)} {headerLinks.map(makeLinks)}
</div> </div>
<div className="navbar__items navbar__items--right"> <div className="navbar__items navbar__items--right">

View file

@ -6,15 +6,11 @@
*/ */
import React from 'react'; import React from 'react';
import Head from '@docusaurus/Head';
import Layout from '@theme/Layout'; import Layout from '@theme/Layout';
function NotFound() { function NotFound() {
return ( return (
<Layout> <Layout title="Page Not Found">
<Head>
<title>Page Not Found</title>
</Head>
<div className="container margin-vert--xl"> <div className="container margin-vert--xl">
<div className="row"> <div className="row">
<div className="col col--6 col--offset-3"> <div className="col col--6 col--offset-3">

View file

@ -6,29 +6,12 @@
*/ */
import React from 'react'; import React from 'react';
import Head from '@docusaurus/Head'; // eslint-disable-line
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; // eslint-disable-line
import Footer from '@theme/Footer'; // eslint-disable-line
import Layout from '@theme/Layout'; // eslint-disable-line import Layout from '@theme/Layout'; // eslint-disable-line
function Pages({content}) { function Pages({content: PageContent}) {
const context = useDocusaurusContext();
const {metadata = {}, siteConfig = {}} = context;
const {baseUrl, favicon} = siteConfig;
const {language} = metadata;
const PageContents = content;
return ( return (
<Layout> <Layout>
<Head defaultTitle={siteConfig.title}> <PageContent />
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
{language && <html lang={language} />}
{language && <meta name="docsearch:language" content={language} />}
</Head>
<PageContents />
<Footer />
</Layout> </Layout>
); );
} }

View file

@ -7,7 +7,7 @@
import React from 'react'; import React from 'react';
import Link from '@docusaurus/Link'; import Link from '@docusaurus/Link'; // eslint-disable-line
import './styles.css'; import './styles.css';
@ -18,7 +18,7 @@ function Sidebar(props) {
docsMetadata.permalinkToId[location.pathname] || docsMetadata.permalinkToId[location.pathname] ||
docsMetadata.permalinkToId[location.pathname.replace(/\/$/, '')]; docsMetadata.permalinkToId[location.pathname.replace(/\/$/, '')];
const metadata = docsMetadata.docs[id] || {}; const metadata = docsMetadata.docs[id] || {};
const {sidebar, language} = metadata; const {sidebar} = metadata;
if (!sidebar) { if (!sidebar) {
return null; return null;
@ -31,7 +31,7 @@ function Sidebar(props) {
} }
const convertDocLink = item => { const convertDocLink = item => {
const linkID = (language ? `${language}-` : '') + item.id; const linkID = item.id;
const linkMetadata = docsMetadata.docs[linkID]; const linkMetadata = docsMetadata.docs[linkID];
if (!linkMetadata) { if (!linkMetadata) {

View file

@ -9,7 +9,6 @@ const path = require('path');
const {generate} = require('@docusaurus/utils'); const {generate} = require('@docusaurus/utils');
const loadConfig = require('./load/config'); const loadConfig = require('./load/config');
const loadEnv = require('./load/env');
const loadTheme = require('./load/theme'); const loadTheme = require('./load/theme');
const loadRoutes = require('./load/routes'); const loadRoutes = require('./load/routes');
const loadPlugins = require('./load/plugins'); const loadPlugins = require('./load/plugins');
@ -29,14 +28,7 @@ module.exports = async function load(siteDir, cliOptions = {}) {
`export default ${JSON.stringify(siteConfig, null, 2)};`, `export default ${JSON.stringify(siteConfig, null, 2)};`,
); );
const env = loadEnv({siteDir, siteConfig}); const context = {siteDir, generatedFilesDir, siteConfig, cliOptions};
await generate(
generatedFilesDir,
'env.js',
`export default ${JSON.stringify(env, null, 2)};`,
);
const context = {env, siteDir, generatedFilesDir, siteConfig, cliOptions};
// Process presets. // Process presets.
const presetPlugins = loadPresets(context); const presetPlugins = loadPresets(context);
@ -88,7 +80,6 @@ ${Object.keys(registry)
const props = { const props = {
siteConfig, siteConfig,
siteDir, siteDir,
env,
outDir, outDir,
themePath, themePath,
baseUrl, baseUrl,

View file

@ -1,7 +1,7 @@
--- ---
id: permalink id: permalink
title: Permalink title: Permalink
permalink: :baseUrl:docsUrl/:langPart/:versionPart/endiliey/:id permalink: :baseUrl:docsUrl/endiliey/:id
--- ---
This has a different permalink This has a different permalink

View file

@ -6,8 +6,8 @@
*/ */
import path from 'path'; import path from 'path';
import loadConfig from '@lib/server/load/config'; import loadConfig from '../config';
import loadSetup from '../loadSetup'; import loadSetup from './loadSetup';
describe('loadConfig', () => { describe('loadConfig', () => {
test('website with valid siteConfig', async () => { test('website with valid siteConfig', async () => {

View file

@ -7,28 +7,19 @@
import '@babel/polyfill'; import '@babel/polyfill';
import path from 'path'; import path from 'path';
import load from '@lib/server'; import load from '../../index';
// Helper methods to setup dummy/fake projects // Helper methods to setup dummy/fake projects
const loadSetup = async name => { const loadSetup = async name => {
const fixtures = path.join(__dirname, '__fixtures__'); const fixtures = path.join(__dirname, '__fixtures__');
const simpleSite = path.join(fixtures, 'simple-site'); const simpleSite = path.join(fixtures, 'simple-site');
const customSite = path.join(fixtures, 'custom-site'); const customSite = path.join(fixtures, 'custom-site');
const versionedSite = path.join(fixtures, 'versioned-site');
const translatedSite = path.join(fixtures, 'translated-site');
const transversionedSite = path.join(fixtures, 'transversioned-site');
switch (name) { switch (name) {
case 'simple': case 'simple':
return load(simpleSite); return load(simpleSite);
case 'custom': case 'custom':
return load(customSite); return load(customSite);
case 'versioned':
return load(versionedSite);
case 'transversioned':
return load(transversionedSite);
case 'translated':
return load(translatedSite);
default: default:
return {}; return {};
} }

View file

@ -0,0 +1,42 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import loadSetup from './loadSetup';
describe('loadRoutes', () => {
test('simple website', async () => {
const {routesPaths} = await loadSetup('simple');
expect(routesPaths.length).toBeGreaterThan(0);
expect(routesPaths.sort()).toMatchInlineSnapshot(`
Array [
"/",
"/docs/endiliey/permalink",
"/docs/foo/bar",
"/docs/foo/baz",
"/docs/hello",
"/hello/world",
]
`);
});
test('custom website', async () => {
const {routesPaths} = await loadSetup('custom');
expect(routesPaths.length).toBeGreaterThan(0);
expect(routesPaths.sort()).toMatchInlineSnapshot(`
Array [
"/sakura/",
"/sakura/bar/baz",
"/sakura/docs/endiliey/permalink",
"/sakura/docs/foo/bar",
"/sakura/docs/foo/baz",
"/sakura/docs/hello",
"/sakura/foo",
"/sakura/foo/",
]
`);
});
});

View file

@ -1,71 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const fs = require('fs-extra');
const path = require('path');
const {idx} = require('@docusaurus/utils');
const {CONFIG_FILE_NAME} = require('../../constants');
module.exports = function loadEnv({siteDir, siteConfig}) {
// Translation.
const translation = {
enabled: false,
enabledLanguages: [],
defaultLanguage: {},
};
const languagesFile = path.join(siteDir, 'languages.js');
delete require.cache[languagesFile];
if (fs.existsSync(languagesFile)) {
const languages = require(languagesFile); // eslint-disable-line
// Enabled languages.
const enabledLanguages = languages.filter(lang => lang.enabled);
if (!enabledLanguages || enabledLanguages.length === 0) {
throw new Error(`Please at least enable one language in 'languages.js'`);
}
translation.enabledLanguages = enabledLanguages;
// Default language.
const {defaultLanguage: defaultLanguageTag} = siteConfig;
const defaultLanguage = enabledLanguages.find(
lang => lang.tag === defaultLanguageTag,
);
if (!defaultLanguage) {
throw new Error(
`Please set a default language in ${CONFIG_FILE_NAME} which is enabled in languages.js`,
);
}
translation.defaultLanguage = defaultLanguage;
translation.enabled = true;
}
// Versioning.
const versioning = {
enabled: false,
latestVersion: null,
defaultVersion: null,
versions: [],
};
const versionsJSONFile = path.join(siteDir, 'versions.json');
delete require.cache[versionsJSONFile];
if (fs.existsSync(versionsJSONFile)) {
versioning.enabled = true;
versioning.versions = JSON.parse(fs.readFileSync(versionsJSONFile, 'utf8'));
versioning.latestVersion = idx(versioning, ['versions', 0]);
const {defaultVersionShown} = siteConfig;
versioning.defaultVersion = defaultVersionShown || versioning.latestVersion;
}
return {
translation,
versioning,
};
};

View file

@ -14,16 +14,9 @@ module.exports = function loadConfig(siteDir) {
? customThemePath ? customThemePath
: path.resolve(__dirname, '../../default-theme'); : path.resolve(__dirname, '../../default-theme');
const themeComponents = [ const requiredComponents = ['Loading', 'NotFound'];
'Doc',
'Pages',
'Loading',
'NotFound',
'Markdown',
'Search',
];
themeComponents.forEach(component => { requiredComponents.forEach(component => {
try { try {
require.resolve(path.join(themePath, component)); require.resolve(path.join(themePath, component));
} catch (e) { } catch (e) {

View file

@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import createBaseConfig from '@lib/webpack/base';
import {validate} from 'webpack'; import {validate} from 'webpack';
import loadSetup from '../loadSetup'; import createBaseConfig from '../base';
import loadSetup from '../../server/load/__tests__/loadSetup';
describe('webpack base config', () => { describe('webpack base config', () => {
test('simple', async () => { test('simple', async () => {

View file

@ -5,9 +5,10 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import createClientConfig from '@lib/webpack/client';
import {validate} from 'webpack'; import {validate} from 'webpack';
import loadSetup from '../loadSetup';
import createClientConfig from '../client';
import loadSetup from '../../server/load/__tests__/loadSetup';
describe('webpack dev config', () => { describe('webpack dev config', () => {
test('simple', async () => { test('simple', async () => {

View file

@ -5,9 +5,10 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import createServerConfig from '@lib/webpack/server';
import {validate} from 'webpack'; import {validate} from 'webpack';
import loadSetup from '../loadSetup';
import createServerConfig from '../server';
import loadSetup from '../../server/load/__tests__/loadSetup';
describe('webpack production config', () => { describe('webpack production config', () => {
test('simple', async () => { test('simple', async () => {

View file

@ -9,7 +9,7 @@ import '@babel/polyfill';
import {validate} from 'webpack'; import {validate} from 'webpack';
import path from 'path'; import path from 'path';
import {applyConfigureWebpack} from '@lib/webpack/utils'; import {applyConfigureWebpack} from '../utils';
describe('extending generated webpack config', () => { describe('extending generated webpack config', () => {
test('direct mutation on generated webpack config object', async () => { test('direct mutation on generated webpack config object', async () => {

View file

@ -1,34 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
module.exports = {
title: 'Hello',
tagline: 'Hello World',
organizationName: 'endiliey',
projectName: 'hello',
baseUrl: '/',
defaultLanguage: 'en',
url: 'https://docusaurus.io',
headerLinks: [
{doc: 'foo/bar', label: 'Docs'},
{page: 'hello/world', label: 'Hello'},
],
headerIcon: 'img/docusaurus.svg',
favicon: 'img/docusaurus.ico',
plugins: [
{
name: '@docusaurus/plugin-content-docs',
options: {
path: '../docs',
sidebarPath: require.resolve('./sidebars.json'),
},
},
{
name: '@docusaurus/plugin-content-pages',
},
],
};

View file

@ -1,185 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const languages = [
{
enabled: true,
name: 'English',
tag: 'en',
},
{
enabled: false,
name: '日本語',
tag: 'ja',
},
{
enabled: false,
name: 'العربية',
tag: 'ar',
},
{
enabled: false,
name: 'Bosanski',
tag: 'bs-BA',
},
{
enabled: false,
name: 'Català',
tag: 'ca',
},
{
enabled: false,
name: 'Čeština',
tag: 'cs',
},
{
enabled: false,
name: 'Dansk',
tag: 'da',
},
{
enabled: false,
name: 'Deutsch',
tag: 'de',
},
{
enabled: false,
name: 'Ελληνικά',
tag: 'el',
},
{
enabled: false,
name: 'Español',
tag: 'es-ES',
},
{
enabled: false,
name: 'فارسی',
tag: 'fa-IR',
},
{
enabled: false,
name: 'Suomi',
tag: 'fi',
},
{
enabled: false,
name: 'Français',
tag: 'fr',
},
{
enabled: false,
name: 'עִברִית',
tag: 'he',
},
{
enabled: false,
name: 'Magyar',
tag: 'hu',
},
{
enabled: false,
name: 'Bahasa Indonesia',
tag: 'id-ID',
},
{
enabled: false,
name: 'Italiano',
tag: 'it',
},
{
enabled: false,
name: 'Afrikaans',
tag: 'af',
},
{
enabled: true,
name: '한국어',
tag: 'ko',
},
{
enabled: false,
name: 'मराठी',
tag: 'mr-IN',
},
{
enabled: false,
name: 'Nederlands',
tag: 'nl',
},
{
enabled: false,
name: 'Norsk',
tag: 'no-NO',
},
{
enabled: false,
name: 'Polskie',
tag: 'pl',
},
{
enabled: false,
name: 'Português',
tag: 'pt-PT',
},
{
enabled: false,
name: 'Português (Brasil)',
tag: 'pt-BR',
},
{
enabled: false,
name: 'Română',
tag: 'ro',
},
{
enabled: false,
name: 'Русский',
tag: 'ru',
},
{
enabled: false,
name: 'Slovenský',
tag: 'sk-SK',
},
{
enabled: false,
name: 'Српски језик (Ћирилица)',
tag: 'sr',
},
{
enabled: false,
name: 'Svenska',
tag: 'sv-SE',
},
{
enabled: false,
name: 'Türkçe',
tag: 'tr',
},
{
enabled: false,
name: 'Українська',
tag: 'uk',
},
{
enabled: false,
name: 'Tiếng Việt',
tag: 'vi',
},
{
enabled: false,
name: '简体中文',
tag: 'zh-CN',
},
{
enabled: false,
name: '繁體中文',
tag: 'zh-TW',
},
];
module.exports = languages;

View file

@ -1,22 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Head from '@docusaurus/Head';
export default class World extends React.Component {
render() {
return (
<div>
<Head>
<title>World</title>
</Head>
<div>Hello World </div>
</div>
);
}
}

View file

@ -1,23 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Head from '@docusaurus/Head';
export default class Home extends React.Component {
render() {
return (
<div>
<Head>
<title>Home</title>
<link rel="stylesheet" type="text/css" href="/css/basic.css" />
</Head>
<div>Home ... </div>
</div>
);
}
}

View file

@ -1,11 +0,0 @@
{
"docs": {
"Test": [
"foo/bar",
"foo/baz"
],
"Guides": [
"hello"
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

View file

@ -1,22 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
module.exports = {
title: 'Hello',
tagline: 'Hello World',
organizationName: 'endiliey',
projectName: 'hello',
baseUrl: '/',
defaultLanguage: 'en',
url: 'https://docusaurus.io',
headerLinks: [
{doc: 'foo/bar', label: 'Docs'},
{page: 'hello/world', label: 'Hello'},
],
headerIcon: 'img/docusaurus.svg',
favicon: 'img/docusaurus.ico',
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View file

@ -1,66 +0,0 @@
---
id: bar
title: Bar
---
# Remarkable
> Remarkable로 실시간 편집을 경험하십시오!
깨끗한 슬레이트로 시작하려면`clear` 링크를 클릭하고 결과를 공유하거나 저장하려면`permalink`를 가져옵니다.
***
# h1 제목
## h2 제목
### h3 제목
#### h4 헤딩
##### h5 제목
###### h6 제목
## 수평 규칙
___
***
***
## 활자체 대체
입력기 옵션을 사용하면 결과를 볼 수 있습니다.
(p) (P) + - (r) (t)
테스트 .. 테스트 ... 테스트 ..... 테스트? ..... 테스트! ....
!!!!!! ???? ,,
놀라운 - 굉장한
"Smartypants, 큰 따옴표"
'Smartypants, 작은 따옴표'
## 강조
** 이것은 굵은 글씨입니다 **
__ 이것은 굵은 글씨입니다 __
* 이탤릭체 텍스트 *
_ 이탤릭체 텍스트 _
~~ 삭제 된 텍스트 ~~
위 첨자 : 19 ^ th ^
아래 첨자 : H ~ 2 ~ O
++ 삽입 된 텍스트 ++
== 표시된 텍스트 ==

View file

@ -1,74 +0,0 @@
---
id: baz
title: baz
---
## 이미지
링크와 마찬가지로 이미지에도 각주 스타일 구문이 있습니다.
! [Alt text] [id]
나중에 URL 위치를 정의하는 문서에서 참조로 :
[id] : https://octodex.github.com/images/dojocat.jpg "The Dojocat"
## 링크
[링크 텍스트] (http://dev.nodeca.com)
[제목 링크] (http://nodeca.github.io/pica/demo/ "제목 텍스트!")
자동 변환 된 링크 https://github.com/nodeca/pica (linkify를 사용하도록 설정)
## 각주
각주 1 링크 [^ 첫 번째].
각주 2 링크 [^ 초].
인라인 각주 ^ [인라인 각주의 텍스트] 정의.
중복 된 각주 참조 [^ 초].
[^ first] : 각주 **는 마크 업을 가질 수 있습니다 **
    및 여러 단락.
[^ 초] : 각주 텍스트.
## 정의 목록
1 학기
정의 1
게으른 연속.
* 인라인 마크 업과 함께 2 학기 *
: 정의 2
        {일부 코드, 정의 2의 일부}
    정의의 세 번째 단락 2.
_ 컴팩트 스타일 : _
1 학기
  ~ 정의 1
2 학기
  ~ 정의 2a
  ~ 정의 2b
## 약어
이것은 HTML 약어입니다.
그것은 "HTML"을 변환하지만 "xxxHTMLyyy"와 같이 부분적인 항목을 그대로 유지합니다.
* [HTML] : 하이퍼 텍스트 마크 업 언어

View file

@ -1,54 +0,0 @@
---
id: hello
title: Hello, World !
---
안녕하세요, 여기 엔 틸리에 :)
## 상대 링크
이것 바꾸기
[foo](foo/bar.md)
이것을 대체 할 수 없습니다.
[파일] (file.md)
아래를 교체하지 마십시오.
```
[hello] (hello.md)
```
## Blockquotes
> Blockquotes는 또한 중첩 될 수 있습니다 ...
>> ... 서로 옆에 큰 더 큰 부호를 사용하여 ...
>>> ... 또는 화살표 사이에 공백이 있어야합니다.
## 목록
정렬되지 않은
+`+`,`-` 또는`*`를 사용하여 행을 시작하여 목록을 만듭니다.
+ 하위 목록은 2 칸을 들여서 만들어집니다 :
   - 마커 문자 변경으로 새로운 목록 시작 :
     * AC tristique libero volutpat at
     + Preisium nisl aliquet에 대한 + 시설
     - Nulla volutpat aliquam velit
+ 매우 쉽습니다!
주문 됨
1. Lorem ipsum dolor sit amet
2. 컨소시엄 adipiscing 엘리트
3. massa에서의 정수 lorem
1. 일련 번호를 사용할 수 있습니다 ...
1. ... 또는 모든 숫자를 '1'로 유지하십시오.
오프셋을 사용하여 번호 매기기 시작 :
57. foo
1. 막대기

View file

@ -1,34 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
module.exports = {
title: 'Hello',
tagline: 'Hello World',
organizationName: 'endiliey',
projectName: 'hello',
baseUrl: '/',
defaultLanguage: 'en',
url: 'https://docusaurus.io',
headerLinks: [
{doc: 'foo/bar', label: 'Docs'},
{page: 'hello/world', label: 'Hello'},
],
headerIcon: 'img/docusaurus.svg',
favicon: 'img/docusaurus.ico',
plugins: [
{
name: '@docusaurus/plugin-content-docs',
options: {
path: '../docs',
sidebarPath: require.resolve('./sidebars.json'),
},
},
{
name: '@docusaurus/plugin-content-pages',
},
],
};

View file

@ -1,185 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const languages = [
{
enabled: true,
name: 'English',
tag: 'en',
},
{
enabled: false,
name: '日本語',
tag: 'ja',
},
{
enabled: false,
name: 'العربية',
tag: 'ar',
},
{
enabled: false,
name: 'Bosanski',
tag: 'bs-BA',
},
{
enabled: false,
name: 'Català',
tag: 'ca',
},
{
enabled: false,
name: 'Čeština',
tag: 'cs',
},
{
enabled: false,
name: 'Dansk',
tag: 'da',
},
{
enabled: false,
name: 'Deutsch',
tag: 'de',
},
{
enabled: false,
name: 'Ελληνικά',
tag: 'el',
},
{
enabled: false,
name: 'Español',
tag: 'es-ES',
},
{
enabled: false,
name: 'فارسی',
tag: 'fa-IR',
},
{
enabled: false,
name: 'Suomi',
tag: 'fi',
},
{
enabled: false,
name: 'Français',
tag: 'fr',
},
{
enabled: false,
name: 'עִברִית',
tag: 'he',
},
{
enabled: false,
name: 'Magyar',
tag: 'hu',
},
{
enabled: false,
name: 'Bahasa Indonesia',
tag: 'id-ID',
},
{
enabled: false,
name: 'Italiano',
tag: 'it',
},
{
enabled: false,
name: 'Afrikaans',
tag: 'af',
},
{
enabled: true,
name: '한국어',
tag: 'ko',
},
{
enabled: false,
name: 'मराठी',
tag: 'mr-IN',
},
{
enabled: false,
name: 'Nederlands',
tag: 'nl',
},
{
enabled: false,
name: 'Norsk',
tag: 'no-NO',
},
{
enabled: false,
name: 'Polskie',
tag: 'pl',
},
{
enabled: false,
name: 'Português',
tag: 'pt-PT',
},
{
enabled: false,
name: 'Português (Brasil)',
tag: 'pt-BR',
},
{
enabled: false,
name: 'Română',
tag: 'ro',
},
{
enabled: false,
name: 'Русский',
tag: 'ru',
},
{
enabled: false,
name: 'Slovenský',
tag: 'sk-SK',
},
{
enabled: false,
name: 'Српски језик (Ћирилица)',
tag: 'sr',
},
{
enabled: false,
name: 'Svenska',
tag: 'sv-SE',
},
{
enabled: false,
name: 'Türkçe',
tag: 'tr',
},
{
enabled: false,
name: 'Українська',
tag: 'uk',
},
{
enabled: false,
name: 'Tiếng Việt',
tag: 'vi',
},
{
enabled: false,
name: '简体中文',
tag: 'zh-CN',
},
{
enabled: false,
name: '繁體中文',
tag: 'zh-TW',
},
];
module.exports = languages;

View file

@ -1,22 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Head from '@docusaurus/Head';
export default class World extends React.Component {
render() {
return (
<div>
<Head>
<title>World</title>
</Head>
<div>Hello World </div>
</div>
);
}
}

View file

@ -1,23 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Head from '@docusaurus/Head';
export default class Home extends React.Component {
render() {
return (
<div>
<Head>
<title>Home</title>
<link rel="stylesheet" type="text/css" href="/css/basic.css" />
</Head>
<div>Home ... </div>
</div>
);
}
}

View file

@ -1,11 +0,0 @@
{
"docs": {
"Test": [
"foo/bar",
"foo/baz"
],
"Guides": [
"hello"
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

View file

@ -1,22 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
module.exports = {
title: 'Hello',
tagline: 'Hello World',
organizationName: 'endiliey',
projectName: 'hello',
baseUrl: '/',
defaultLanguage: 'en',
url: 'https://docusaurus.io',
headerLinks: [
{doc: 'foo/bar', label: 'Docs'},
{page: 'hello/world', label: 'Hello'},
],
headerIcon: 'img/docusaurus.svg',
favicon: 'img/docusaurus.ico',
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View file

@ -1,66 +0,0 @@
---
id: bar
title: Bar
---
# Remarkable
> Remarkable로 실시간 편집을 경험하십시오!
깨끗한 슬레이트로 시작하려면`clear` 링크를 클릭하고 결과를 공유하거나 저장하려면`permalink`를 가져옵니다.
***
# h1 제목
## h2 제목
### h3 제목
#### h4 헤딩
##### h5 제목
###### h6 제목
## 수평 규칙
___
***
***
## 활자체 대체
입력기 옵션을 사용하면 결과를 볼 수 있습니다.
(p) (P) + - (r) (t)
테스트 .. 테스트 ... 테스트 ..... 테스트? ..... 테스트! ....
!!!!!! ???? ,,
놀라운 - 굉장한
"Smartypants, 큰 따옴표"
'Smartypants, 작은 따옴표'
## 강조
** 이것은 굵은 글씨입니다 **
__ 이것은 굵은 글씨입니다 __
* 이탤릭체 텍스트 *
_ 이탤릭체 텍스트 _
~~ 삭제 된 텍스트 ~~
위 첨자 : 19 ^ th ^
아래 첨자 : H ~ 2 ~ O
++ 삽입 된 텍스트 ++
== 표시된 텍스트 ==

View file

@ -1,74 +0,0 @@
---
id: baz
title: baz
---
## 이미지
링크와 마찬가지로 이미지에도 각주 스타일 구문이 있습니다.
! [Alt text] [id]
나중에 URL 위치를 정의하는 문서에서 참조로 :
[id] : https://octodex.github.com/images/dojocat.jpg "The Dojocat"
## 링크
[링크 텍스트] (http://dev.nodeca.com)
[제목 링크] (http://nodeca.github.io/pica/demo/ "제목 텍스트!")
자동 변환 된 링크 https://github.com/nodeca/pica (linkify를 사용하도록 설정)
## 각주
각주 1 링크 [^ 첫 번째].
각주 2 링크 [^ 초].
인라인 각주 ^ [인라인 각주의 텍스트] 정의.
중복 된 각주 참조 [^ 초].
[^ first] : 각주 **는 마크 업을 가질 수 있습니다 **
    및 여러 단락.
[^ 초] : 각주 텍스트.
## 정의 목록
1 학기
정의 1
게으른 연속.
* 인라인 마크 업과 함께 2 학기 *
: 정의 2
        {일부 코드, 정의 2의 일부}
    정의의 세 번째 단락 2.
_ 컴팩트 스타일 : _
1 학기
  ~ 정의 1
2 학기
  ~ 정의 2a
  ~ 정의 2b
## 약어
이것은 HTML 약어입니다.
그것은 "HTML"을 변환하지만 "xxxHTMLyyy"와 같이 부분적인 항목을 그대로 유지합니다.
* [HTML] : 하이퍼 텍스트 마크 업 언어

View file

@ -1,54 +0,0 @@
---
id: hello
title: Hello, World !
---
안녕하세요, 여기 엔 틸리에 :)
## 상대 링크
이것 바꾸기
[foo](foo/bar.md)
이것을 대체 할 수 없습니다.
[파일] (file.md)
아래를 교체하지 마십시오.
```
[hello] (hello.md)
```
## Blockquotes
> Blockquotes는 또한 중첩 될 수 있습니다 ...
>> ... 서로 옆에 큰 더 큰 부호를 사용하여 ...
>>> ... 또는 화살표 사이에 공백이 있어야합니다.
## 목록
정렬되지 않은
+`+`,`-` 또는`*`를 사용하여 행을 시작하여 목록을 만듭니다.
+ 하위 목록은 2 칸을 들여서 만들어집니다 :
   - 마커 문자 변경으로 새로운 목록 시작 :
     * AC tristique libero volutpat at
     + Preisium nisl aliquet에 대한 + 시설
     - Nulla volutpat aliquam velit
+ 매우 쉽습니다!
주문 됨
1. Lorem ipsum dolor sit amet
2. 컨소시엄 adipiscing 엘리트
3. massa에서의 정수 lorem
1. 일련 번호를 사용할 수 있습니다 ...
1. ... 또는 모든 숫자를 '1'로 유지하십시오.
오프셋을 사용하여 번호 매기기 시작 :
57. foo
1. 막대기

View file

@ -1,66 +0,0 @@
---
id: version-1.0.0-bar
title: Bar
---
# Remarkable
> Remarkable로 실시간 편집을 경험하십시오!
깨끗한 슬레이트로 시작하려면`clear` 링크를 클릭하고 결과를 공유하거나 저장하려면`permalink`를 가져옵니다.
***
# h1 제목
## h2 제목
### h3 제목
#### h4 헤딩
##### h5 제목
###### h6 제목
## 수평 규칙
___
***
***
## 활자체 대체
입력기 옵션을 사용하면 결과를 볼 수 있습니다.
(p) (P) + - (r) (t)
테스트 .. 테스트 ... 테스트 ..... 테스트? ..... 테스트! ....
!!!!!! ???? ,,
놀라운 - 굉장한
"Smartypants, 큰 따옴표"
'Smartypants, 작은 따옴표'
## 강조
** 이것은 굵은 글씨입니다 **
__ 이것은 굵은 글씨입니다 __
* 이탤릭체 텍스트 *
_ 이탤릭체 텍스트 _
~~ 삭제 된 텍스트 ~~
위 첨자 : 19 ^ th ^
아래 첨자 : H ~ 2 ~ O
++ 삽입 된 텍스트 ++
== 표시된 텍스트 ==

View file

@ -1,74 +0,0 @@
---
id: version-1.0.0-baz
title: baz
---
## 이미지
링크와 마찬가지로 이미지에도 각주 스타일 구문이 있습니다.
! [Alt text] [id]
나중에 URL 위치를 정의하는 문서에서 참조로 :
[id] : https://octodex.github.com/images/dojocat.jpg "The Dojocat"
## 링크
[링크 텍스트] (http://dev.nodeca.com)
[제목 링크] (http://nodeca.github.io/pica/demo/ "제목 텍스트!")
자동 변환 된 링크 https://github.com/nodeca/pica (linkify를 사용하도록 설정)
## 각주
각주 1 링크 [^ 첫 번째].
각주 2 링크 [^ 초].
인라인 각주 ^ [인라인 각주의 텍스트] 정의.
중복 된 각주 참조 [^ 초].
[^ first] : 각주 **는 마크 업을 가질 수 있습니다 **
    및 여러 단락.
[^ 초] : 각주 텍스트.
## 정의 목록
1 학기
정의 1
게으른 연속.
* 인라인 마크 업과 함께 2 학기 *
: 정의 2
        {일부 코드, 정의 2의 일부}
    정의의 세 번째 단락 2.
_ 컴팩트 스타일 : _
1 학기
  ~ 정의 1
2 학기
  ~ 정의 2a
  ~ 정의 2b
## 약어
이것은 HTML 약어입니다.
그것은 "HTML"을 변환하지만 "xxxHTMLyyy"와 같이 부분적인 항목을 그대로 유지합니다.
* [HTML] : 하이퍼 텍스트 마크 업 언어

View file

@ -1,54 +0,0 @@
---
id: version-1.0.0-hello
title: Hello, World !
---
안녕하세요, 여기 엔 틸리에 :)
## 상대 링크
이것 바꾸기
[foo](foo/bar.md)
이것을 대체 할 수 없습니다.
[파일] (file.md)
아래를 교체하지 마십시오.
```
[hello] (hello.md)
```
## Blockquotes
> Blockquotes는 또한 중첩 될 수 있습니다 ...
>> ... 서로 옆에 큰 더 큰 부호를 사용하여 ...
>>> ... 또는 화살표 사이에 공백이 있어야합니다.
## 목록
정렬되지 않은
+`+`,`-` 또는`*`를 사용하여 행을 시작하여 목록을 만듭니다.
+ 하위 목록은 2 칸을 들여서 만들어집니다 :
   - 마커 문자 변경으로 새로운 목록 시작 :
     * AC tristique libero volutpat at
     + Preisium nisl aliquet에 대한 + 시설
     - Nulla volutpat aliquam velit
+ 매우 쉽습니다!
주문 됨
1. Lorem ipsum dolor sit amet
2. 컨소시엄 adipiscing 엘리트
3. massa에서의 정수 lorem
1. 일련 번호를 사용할 수 있습니다 ...
1. ... 또는 모든 숫자를 '1'로 유지하십시오.
오프셋을 사용하여 번호 매기기 시작 :
57. foo
1. 막대기

View file

@ -1,66 +0,0 @@
---
id: version-1.0.1-bar
title: Bar
---
# Remarkable
> Remarkable로 실시간 편집을 경험하십시오!
깨끗한 슬레이트로 시작하려면`clear` 링크를 클릭하고 결과를 공유하거나 저장하려면`permalink`를 가져옵니다.
***
# h1 제목
## h2 제목
### h3 제목
#### h4 헤딩
##### h5 제목
###### h6 제목
## 수평 규칙
___
***
***
## 활자체 대체
입력기 옵션을 사용하면 결과를 볼 수 있습니다.
(p) (P) + - (r) (t)
테스트 .. 테스트 ... 테스트 ..... 테스트? ..... 테스트! ....
!!!!!! ???? ,,
놀라운 - 굉장한
"Smartypants, 큰 따옴표"
'Smartypants, 작은 따옴표'
## 강조
** 이것은 굵은 글씨입니다 **
__ 이것은 굵은 글씨입니다 __
* 이탤릭체 텍스트 *
_ 이탤릭체 텍스트 _
~~ 삭제 된 텍스트 ~~
위 첨자 : 19 ^ th ^
아래 첨자 : H ~ 2 ~ O
++ 삽입 된 텍스트 ++
== 표시된 텍스트 ==

View file

@ -1,74 +0,0 @@
---
id: version-1.0.1-baz
title: baz
---
## 이미지
링크와 마찬가지로 이미지에도 각주 스타일 구문이 있습니다.
! [Alt text] [id]
나중에 URL 위치를 정의하는 문서에서 참조로 :
[id] : https://octodex.github.com/images/dojocat.jpg "The Dojocat"
## 링크
[링크 텍스트] (http://dev.nodeca.com)
[제목 링크] (http://nodeca.github.io/pica/demo/ "제목 텍스트!")
자동 변환 된 링크 https://github.com/nodeca/pica (linkify를 사용하도록 설정)
## 각주
각주 1 링크 [^ 첫 번째].
각주 2 링크 [^ 초].
인라인 각주 ^ [인라인 각주의 텍스트] 정의.
중복 된 각주 참조 [^ 초].
[^ first] : 각주 **는 마크 업을 가질 수 있습니다 **
    및 여러 단락.
[^ 초] : 각주 텍스트.
## 정의 목록
1 학기
정의 1
게으른 연속.
* 인라인 마크 업과 함께 2 학기 *
: 정의 2
        {일부 코드, 정의 2의 일부}
    정의의 세 번째 단락 2.
_ 컴팩트 스타일 : _
1 학기
  ~ 정의 1
2 학기
  ~ 정의 2a
  ~ 정의 2b
## 약어
이것은 HTML 약어입니다.
그것은 "HTML"을 변환하지만 "xxxHTMLyyy"와 같이 부분적인 항목을 그대로 유지합니다.
* [HTML] : 하이퍼 텍스트 마크 업 언어

View file

@ -1,54 +0,0 @@
---
id: version-1.0.1-hello
title: Hello, World !
---
안녕하세요, 여기 엔 틸리에 :)
## 상대 링크
이것 바꾸기
[foo](foo/bar.md)
이것을 대체 할 수 없습니다.
[파일] (file.md)
아래를 교체하지 마십시오.
```
[hello] (hello.md)
```
## Blockquotes
> Blockquotes는 또한 중첩 될 수 있습니다 ...
>> ... 서로 옆에 큰 더 큰 부호를 사용하여 ...
>>> ... 또는 화살표 사이에 공백이 있어야합니다.
## 목록
정렬되지 않은
+`+`,`-` 또는`*`를 사용하여 행을 시작하여 목록을 만듭니다.
+ 하위 목록은 2 칸을 들여서 만들어집니다 :
   - 마커 문자 변경으로 새로운 목록 시작 :
     * AC tristique libero volutpat at
     + Preisium nisl aliquet에 대한 + 시설
     - Nulla volutpat aliquam velit
+ 매우 쉽습니다!
주문 됨
1. Lorem ipsum dolor sit amet
2. 컨소시엄 adipiscing 엘리트
3. massa에서의 정수 lorem
1. 일련 번호를 사용할 수 있습니다 ...
1. ... 또는 모든 숫자를 '1'로 유지하십시오.
오프셋을 사용하여 번호 매기기 시작 :
57. foo
1. 막대기

View file

@ -1,66 +0,0 @@
---
id: version-1.0.0-bar
title: Bar
---
# Remarkable
> Experience real-time editing with Remarkable!
Click the `clear` link to start with a clean slate, or get the `permalink` to share or save your results.
***
# h1 Heading
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading
## Horizontal Rules
___
***
***
## Typographic replacements
Enable typographer option to see result.
(c) (C) (r) (R) (tm) (TM) (p) (P) +-
test.. test... test..... test?..... test!....
!!!!!! ???? ,,
Remarkable -- awesome
"Smartypants, double quotes"
'Smartypants, single quotes'
## Emphasis
**This is bold text**
__This is bold text__
*This is italic text*
_This is italic text_
~~Deleted text~~
Superscript: 19^th^
Subscript: H~2~O
++Inserted text++
==Marked text==

View file

@ -1,74 +0,0 @@
---
id: version-1.0.0-baz
title: Baz
---
## Images
Like links, Images also have a footnote style syntax
![Alt text][id]
With a reference later in the document defining the URL location:
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
## Links
[link text](http://dev.nodeca.com)
[link with title](http://nodeca.github.io/pica/demo/ "title text!")
Autoconverted link https://github.com/nodeca/pica (enable linkify to see)
## Footnotes
Footnote 1 link[^first].
Footnote 2 link[^second].
Inline footnote^[Text of inline footnote] definition.
Duplicated footnote reference[^second].
[^first]: Footnote **can have markup**
and multiple paragraphs.
[^second]: Footnote text.
## Definition lists
Term 1
: Definition 1
with lazy continuation.
Term 2 with *inline markup*
: Definition 2
{ some code, part of Definition 2 }
Third paragraph of definition 2.
_Compact style:_
Term 1
~ Definition 1
Term 2
~ Definition 2a
~ Definition 2b
## Abbreviations
This is HTML abbreviation example.
It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.
*[HTML]: Hyper Text Markup Language

View file

@ -1,54 +0,0 @@
---
id: version-1.0.0-hello
title: Hello, World !
---
Hi, Endilie here :)
## Relative links
Replace this
[foo](foo/bar.md)
Can't replace this
[file](file.md)
Do not replace below
```
[hello](hello.md)
```
## Blockquotes
> Blockquotes can also be nested...
>> ...by using additional greater-than signs right next to each other...
> > > ...or with spaces between arrows.
## Lists
Unordered
+ Create a list by starting a line with `+`, `-`, or `*`
+ Sub-lists are made by indenting 2 spaces:
- Marker character change forces new list start:
* Ac tristique libero volutpat at
+ Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
+ Very easy!
Ordered
1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa
1. You can use sequential numbers...
1. ...or keep all the numbers as `1.`
Start numbering with offset:
57. foo
1. bar

View file

@ -1,66 +0,0 @@
---
id: version-1.0.1-bar
title: Bar
---
# Remarkable
> Experience real-time editing with Remarkable!
Click the `clear` link to start with a clean slate, or get the `permalink` to share or save your results.
***
# h1 Heading
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading
## Horizontal Rules
___
***
***
## Typographic replacements
Enable typographer option to see result.
(c) (C) (r) (R) (tm) (TM) (p) (P) +-
test.. test... test..... test?..... test!....
!!!!!! ???? ,,
Remarkable -- awesome
"Smartypants, double quotes"
'Smartypants, single quotes'
## Emphasis
**This is bold text**
__This is bold text__
*This is italic text*
_This is italic text_
~~Deleted text~~
Superscript: 19^th^
Subscript: H~2~O
++Inserted text++
==Marked text==

View file

@ -1,74 +0,0 @@
---
id: version-1.0.1-baz
title: Baz
---
## Images
Like links, Images also have a footnote style syntax
![Alt text][id]
With a reference later in the document defining the URL location:
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
## Links
[link text](http://dev.nodeca.com)
[link with title](http://nodeca.github.io/pica/demo/ "title text!")
Autoconverted link https://github.com/nodeca/pica (enable linkify to see)
## Footnotes
Footnote 1 link[^first].
Footnote 2 link[^second].
Inline footnote^[Text of inline footnote] definition.
Duplicated footnote reference[^second].
[^first]: Footnote **can have markup**
and multiple paragraphs.
[^second]: Footnote text.
## Definition lists
Term 1
: Definition 1
with lazy continuation.
Term 2 with *inline markup*
: Definition 2
{ some code, part of Definition 2 }
Third paragraph of definition 2.
_Compact style:_
Term 1
~ Definition 1
Term 2
~ Definition 2a
~ Definition 2b
## Abbreviations
This is HTML abbreviation example.
It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.
*[HTML]: Hyper Text Markup Language

View file

@ -1,54 +0,0 @@
---
id: version-1.0.1-hello
title: Hello, World !
---
Hi, Endilie here :)
## Relative links
Replace this
[foo](foo/bar.md)
Can't replace this
[file](file.md)
Do not replace below
```
[hello](hello.md)
```
## Blockquotes
> Blockquotes can also be nested...
>> ...by using additional greater-than signs right next to each other...
> > > ...or with spaces between arrows.
## Lists
Unordered
+ Create a list by starting a line with `+`, `-`, or `*`
+ Sub-lists are made by indenting 2 spaces:
- Marker character change forces new list start:
* Ac tristique libero volutpat at
+ Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
+ Very easy!
Ordered
1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa
1. You can use sequential numbers...
1. ...or keep all the numbers as `1.`
Start numbering with offset:
57. foo
1. bar

View file

@ -1,11 +0,0 @@
{
"version-1.0.0-docs": {
"Test": [
"version-1.0.0-foo/bar",
"version-1.0.0-foo/baz"
],
"Guides": [
"version-1.0.0-hello"
]
}
}

View file

@ -1,11 +0,0 @@
{
"version-1.0.1-docs": {
"Test": [
"version-1.0.1-foo/bar",
"version-1.0.1-foo/baz"
],
"Guides": [
"version-1.0.1-hello"
]
}
}

View file

@ -1,4 +0,0 @@
[
"1.0.1",
"1.0.0"
]

View file

@ -1,33 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
module.exports = {
title: 'Hello',
tagline: 'Hello World',
organizationName: 'endiliey',
projectName: 'hello',
baseUrl: '/',
url: 'https://docusaurus.io',
headerLinks: [
{doc: 'foo/bar', label: 'Docs'},
{page: 'hello/world', label: 'Hello'},
],
headerIcon: 'img/docusaurus.svg',
favicon: 'img/docusaurus.ico',
plugins: [
{
name: '@docusaurus/plugin-content-docs',
options: {
path: '../docs',
sidebarPath: require.resolve('./sidebars.json'),
},
},
{
name: '@docusaurus/plugin-content-pages',
},
],
};

Some files were not shown because too many files have changed in this diff Show more