mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 22:17:00 +02:00
refactor(v2): merge linkify function used in blog and docs and align properties (#4402)
* refactor(v2): merge linkify function used in blog and docs * refactor(v2): rename docsDirPath and docsDirPathLocalized ad update types * refactor(v2): rename blogPostsBySource and update types * improve replaceMarkdownLinks api Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
bfe52cdae3
commit
2f53b1a895
17 changed files with 240 additions and 237 deletions
|
@ -60,6 +60,8 @@ exports[`translateLoadedContent should return translated loaded content matching
|
|||
Object {
|
||||
"loadedVersions": Array [
|
||||
Object {
|
||||
"contentPath": "any",
|
||||
"contentPathLocalized": "any",
|
||||
"docs": Array [
|
||||
Object {
|
||||
"description": "doc1 description",
|
||||
|
@ -147,8 +149,6 @@ Object {
|
|||
"version": "any",
|
||||
},
|
||||
],
|
||||
"docsDirPath": "any",
|
||||
"docsDirPathLocalized": "any",
|
||||
"isLast": true,
|
||||
"mainDocId": "",
|
||||
"permalinkToSidebar": Object {},
|
||||
|
@ -201,6 +201,8 @@ Object {
|
|||
"versionPath": "/docs/",
|
||||
},
|
||||
Object {
|
||||
"contentPath": "any",
|
||||
"contentPathLocalized": "any",
|
||||
"docs": Array [
|
||||
Object {
|
||||
"description": "doc1 description",
|
||||
|
@ -288,8 +290,6 @@ Object {
|
|||
"version": "any",
|
||||
},
|
||||
],
|
||||
"docsDirPath": "any",
|
||||
"docsDirPathLocalized": "any",
|
||||
"isLast": true,
|
||||
"mainDocId": "",
|
||||
"permalinkToSidebar": Object {},
|
||||
|
@ -342,6 +342,8 @@ Object {
|
|||
"versionPath": "/docs/",
|
||||
},
|
||||
Object {
|
||||
"contentPath": "any",
|
||||
"contentPathLocalized": "any",
|
||||
"docs": Array [
|
||||
Object {
|
||||
"description": "doc1 description",
|
||||
|
@ -429,8 +431,6 @@ Object {
|
|||
"version": "any",
|
||||
},
|
||||
],
|
||||
"docsDirPath": "any",
|
||||
"docsDirPathLocalized": "any",
|
||||
"isLast": true,
|
||||
"mainDocId": "",
|
||||
"permalinkToSidebar": Object {},
|
||||
|
|
|
@ -45,7 +45,7 @@ ${markdown}
|
|||
source,
|
||||
content,
|
||||
lastUpdate: {},
|
||||
docsDirPath: 'docs',
|
||||
contentPath: 'docs',
|
||||
filePath: source,
|
||||
};
|
||||
};
|
||||
|
@ -93,7 +93,7 @@ function createTestUtils({
|
|||
editUrl: undefined,
|
||||
source: path.posix.join(
|
||||
'@site',
|
||||
posixPath(path.relative(siteDir, versionMetadata.docsDirPath)),
|
||||
posixPath(path.relative(siteDir, versionMetadata.contentPath)),
|
||||
posixPath(docFileSource),
|
||||
),
|
||||
...expectedMetadata,
|
||||
|
|
|
@ -254,7 +254,7 @@ describe('simple website', () => {
|
|||
sidebar: 'docs',
|
||||
source: path.posix.join(
|
||||
'@site',
|
||||
posixPath(path.relative(siteDir, currentVersion.docsDirPath)),
|
||||
posixPath(path.relative(siteDir, currentVersion.contentPath)),
|
||||
'hello.md',
|
||||
),
|
||||
title: 'Hello, World !',
|
||||
|
@ -276,7 +276,7 @@ describe('simple website', () => {
|
|||
sidebar: 'docs',
|
||||
source: path.posix.join(
|
||||
'@site',
|
||||
posixPath(path.relative(siteDir, currentVersion.docsDirPath)),
|
||||
posixPath(path.relative(siteDir, currentVersion.contentPath)),
|
||||
'foo',
|
||||
'bar.md',
|
||||
),
|
||||
|
@ -424,7 +424,7 @@ describe('versioned website', () => {
|
|||
slug: '/foo/barSlug',
|
||||
source: path.posix.join(
|
||||
'@site',
|
||||
posixPath(path.relative(siteDir, currentVersion.docsDirPath)),
|
||||
posixPath(path.relative(siteDir, currentVersion.contentPath)),
|
||||
'foo',
|
||||
'bar.md',
|
||||
),
|
||||
|
@ -446,7 +446,7 @@ describe('versioned website', () => {
|
|||
slug: '/',
|
||||
source: path.posix.join(
|
||||
'@site',
|
||||
posixPath(path.relative(siteDir, currentVersion.docsDirPath)),
|
||||
posixPath(path.relative(siteDir, currentVersion.contentPath)),
|
||||
'hello.md',
|
||||
),
|
||||
title: 'hello',
|
||||
|
@ -467,7 +467,7 @@ describe('versioned website', () => {
|
|||
slug: '/',
|
||||
source: path.posix.join(
|
||||
'@site',
|
||||
posixPath(path.relative(siteDir, version101.docsDirPath)),
|
||||
posixPath(path.relative(siteDir, version101.contentPath)),
|
||||
'hello.md',
|
||||
),
|
||||
title: 'hello',
|
||||
|
@ -488,7 +488,7 @@ describe('versioned website', () => {
|
|||
slug: '/foo/baz',
|
||||
source: path.posix.join(
|
||||
'@site',
|
||||
posixPath(path.relative(siteDir, version100.docsDirPath)),
|
||||
posixPath(path.relative(siteDir, version100.contentPath)),
|
||||
'foo',
|
||||
'baz.md',
|
||||
),
|
||||
|
@ -649,7 +649,7 @@ describe('versioned website (community)', () => {
|
|||
slug: '/team',
|
||||
source: path.posix.join(
|
||||
'@site',
|
||||
posixPath(path.relative(siteDir, version100.docsDirPath)),
|
||||
posixPath(path.relative(siteDir, version100.contentPath)),
|
||||
'team.md',
|
||||
),
|
||||
title: 'team',
|
||||
|
|
|
@ -44,8 +44,8 @@ function createSampleVersion(
|
|||
routePriority: undefined,
|
||||
sidebarFilePath: 'any',
|
||||
isLast: true,
|
||||
docsDirPath: 'any',
|
||||
docsDirPathLocalized: 'any',
|
||||
contentPath: 'any',
|
||||
contentPathLocalized: 'any',
|
||||
docs: [
|
||||
createSampleDoc({
|
||||
id: 'doc1',
|
||||
|
|
|
@ -68,8 +68,8 @@ describe('simple site', () => {
|
|||
};
|
||||
|
||||
const vCurrent: VersionMetadata = {
|
||||
docsDirPath: path.join(simpleSiteDir, 'docs'),
|
||||
docsDirPathLocalized: path.join(
|
||||
contentPath: path.join(simpleSiteDir, 'docs'),
|
||||
contentPathLocalized: path.join(
|
||||
simpleSiteDir,
|
||||
'i18n/en/docusaurus-plugin-content-docs/current',
|
||||
),
|
||||
|
@ -218,8 +218,8 @@ describe('versioned site, pluginId=default', () => {
|
|||
};
|
||||
|
||||
const vCurrent: VersionMetadata = {
|
||||
docsDirPath: path.join(versionedSiteDir, 'docs'),
|
||||
docsDirPathLocalized: path.join(
|
||||
contentPath: path.join(versionedSiteDir, 'docs'),
|
||||
contentPathLocalized: path.join(
|
||||
versionedSiteDir,
|
||||
'i18n/en/docusaurus-plugin-content-docs/current',
|
||||
),
|
||||
|
@ -232,8 +232,8 @@ describe('versioned site, pluginId=default', () => {
|
|||
};
|
||||
|
||||
const v101: VersionMetadata = {
|
||||
docsDirPath: path.join(versionedSiteDir, 'versioned_docs/version-1.0.1'),
|
||||
docsDirPathLocalized: path.join(
|
||||
contentPath: path.join(versionedSiteDir, 'versioned_docs/version-1.0.1'),
|
||||
contentPathLocalized: path.join(
|
||||
versionedSiteDir,
|
||||
'i18n/en/docusaurus-plugin-content-docs/version-1.0.1',
|
||||
),
|
||||
|
@ -249,8 +249,8 @@ describe('versioned site, pluginId=default', () => {
|
|||
};
|
||||
|
||||
const v100: VersionMetadata = {
|
||||
docsDirPath: path.join(versionedSiteDir, 'versioned_docs/version-1.0.0'),
|
||||
docsDirPathLocalized: path.join(
|
||||
contentPath: path.join(versionedSiteDir, 'versioned_docs/version-1.0.0'),
|
||||
contentPathLocalized: path.join(
|
||||
versionedSiteDir,
|
||||
'i18n/en/docusaurus-plugin-content-docs/version-1.0.0',
|
||||
),
|
||||
|
@ -266,11 +266,11 @@ describe('versioned site, pluginId=default', () => {
|
|||
};
|
||||
|
||||
const vwithSlugs: VersionMetadata = {
|
||||
docsDirPath: path.join(
|
||||
contentPath: path.join(
|
||||
versionedSiteDir,
|
||||
'versioned_docs/version-withSlugs',
|
||||
),
|
||||
docsDirPathLocalized: path.join(
|
||||
contentPathLocalized: path.join(
|
||||
versionedSiteDir,
|
||||
'i18n/en/docusaurus-plugin-content-docs/version-withSlugs',
|
||||
),
|
||||
|
@ -615,8 +615,8 @@ describe('versioned site, pluginId=community', () => {
|
|||
};
|
||||
|
||||
const vCurrent: VersionMetadata = {
|
||||
docsDirPath: path.join(versionedSiteDir, 'community'),
|
||||
docsDirPathLocalized: path.join(
|
||||
contentPath: path.join(versionedSiteDir, 'community'),
|
||||
contentPathLocalized: path.join(
|
||||
versionedSiteDir,
|
||||
'i18n/en/docusaurus-plugin-content-docs-community/current',
|
||||
),
|
||||
|
@ -629,11 +629,11 @@ describe('versioned site, pluginId=community', () => {
|
|||
};
|
||||
|
||||
const v100: VersionMetadata = {
|
||||
docsDirPath: path.join(
|
||||
contentPath: path.join(
|
||||
versionedSiteDir,
|
||||
'community_versioned_docs/version-1.0.0',
|
||||
),
|
||||
docsDirPathLocalized: path.join(
|
||||
contentPathLocalized: path.join(
|
||||
versionedSiteDir,
|
||||
'i18n/en/docusaurus-plugin-content-docs-community/version-1.0.0',
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue