mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
This commit is contained in:
parent
35849b1d34
commit
3c8a8619f9
@ -30,6 +30,12 @@ WEBSITE_BASE_URL=http://localhost:8077 yarn buildDev --locale fr
|
||||
|
||||
`processDocs.js` will also build everything by default, but it takes a long time, so using the above commands is convenient for dev.
|
||||
|
||||
### Watching
|
||||
|
||||
To watch the doc website, run `yarn start` from `packages/doc-builder`
|
||||
|
||||
Alternatively, to test the doc website after it has been built, build it using one of the above commands, then run `yarn watchWebsite` from the root. This allows testing the website in "production" conditions, after prod-only plugins have been executed.
|
||||
|
||||
## Translation
|
||||
|
||||
Translation is done using https://crowdin.com/
|
||||
|
@ -7,6 +7,22 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
||||
// To make their weird linter happy
|
||||
process.env.WEBSITE_BASE_URL = process.env.WEBSITE_BASE_URL || '';
|
||||
|
||||
function rtrimSlashes(path) {
|
||||
return path.replace(/[\/\\]+$/, '');
|
||||
}
|
||||
|
||||
function ltrimSlashes(path) {
|
||||
return path.replace(/^\/+/, '');
|
||||
}
|
||||
|
||||
const explodePath = (path) => {
|
||||
return ltrimSlashes(rtrimSlashes(path)).split('/');
|
||||
}
|
||||
|
||||
const createRedirect = (path) => {
|
||||
return path;
|
||||
}
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: 'Joplin',
|
||||
@ -33,8 +49,98 @@ const config = {
|
||||
plugins: [
|
||||
[
|
||||
require.resolve('docusaurus-lunr-search'),
|
||||
{},
|
||||
],
|
||||
[
|
||||
'@docusaurus/plugin-client-redirects',
|
||||
{
|
||||
// Options here
|
||||
createRedirects(existingPath) {
|
||||
try {
|
||||
const oldAppsPages = [
|
||||
'attachments',
|
||||
'clipper',
|
||||
'config_screen',
|
||||
'conflict',
|
||||
'custom_css',
|
||||
'debugging',
|
||||
'desktop',
|
||||
'email_to_note',
|
||||
'external_links',
|
||||
'external_text_editor',
|
||||
'import_export',
|
||||
'markdown',
|
||||
'mobile',
|
||||
'note_history',
|
||||
'notifications',
|
||||
'plugins',
|
||||
'profiles',
|
||||
'publish_note',
|
||||
'rich_text_editor',
|
||||
'search',
|
||||
'share_notebook',
|
||||
'subnotebooks',
|
||||
'terminal',
|
||||
];
|
||||
|
||||
for (const p of oldAppsPages) {
|
||||
if (existingPath.startsWith('/help/apps/' + p)) {
|
||||
return createRedirect('/' + p);
|
||||
}
|
||||
}
|
||||
|
||||
const oldAboutPages = [
|
||||
'prereleases',
|
||||
'principles',
|
||||
'release_cycle',
|
||||
'stats',
|
||||
];
|
||||
|
||||
for (const p of oldAboutPages) {
|
||||
if (existingPath.startsWith('/help/about/' + p)) {
|
||||
return createRedirect('/' + p);
|
||||
}
|
||||
}
|
||||
|
||||
if (existingPath.startsWith('/help/dev/spec')) {
|
||||
const s = explodePath(existingPath);
|
||||
s.splice(0, 2);
|
||||
return createRedirect('/' + s.join('/'));
|
||||
}
|
||||
|
||||
if (existingPath.startsWith('/help/api')) {
|
||||
const s = explodePath(existingPath);
|
||||
s.splice(0, 2);
|
||||
return createRedirect('/api/' + s.join('/'));
|
||||
}
|
||||
|
||||
if (existingPath.startsWith('/help/about/changelog/')) {
|
||||
const s = explodePath(existingPath);
|
||||
const last = s.pop();
|
||||
if (last === 'desktop') {
|
||||
return createRedirect('/changelog');
|
||||
} else {
|
||||
return createRedirect('/changelog_' + last);
|
||||
}
|
||||
}
|
||||
|
||||
if (existingPath === '/help/faq') {
|
||||
return createRedirect('/faq');
|
||||
}
|
||||
|
||||
if (existingPath === '/help/apps/sync/e2ee') {
|
||||
return createRedirect('/e2ee');
|
||||
}
|
||||
|
||||
if (existingPath === '/help/api') {
|
||||
return createRedirect('/api/overview');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('For existingPath = ', existingPath);
|
||||
throw error;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
|
@ -17,6 +17,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.4.3",
|
||||
"@docusaurus/plugin-client-redirects": "2.4.3",
|
||||
"@docusaurus/preset-classic": "2.4.3",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"clsx": "^1.2.1",
|
||||
|
21
yarn.lock
21
yarn.lock
@ -4801,6 +4801,26 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@docusaurus/plugin-client-redirects@npm:2.4.3":
|
||||
version: 2.4.3
|
||||
resolution: "@docusaurus/plugin-client-redirects@npm:2.4.3"
|
||||
dependencies:
|
||||
"@docusaurus/core": 2.4.3
|
||||
"@docusaurus/logger": 2.4.3
|
||||
"@docusaurus/utils": 2.4.3
|
||||
"@docusaurus/utils-common": 2.4.3
|
||||
"@docusaurus/utils-validation": 2.4.3
|
||||
eta: ^2.0.0
|
||||
fs-extra: ^10.1.0
|
||||
lodash: ^4.17.21
|
||||
tslib: ^2.4.0
|
||||
peerDependencies:
|
||||
react: ^16.8.4 || ^17.0.0
|
||||
react-dom: ^16.8.4 || ^17.0.0
|
||||
checksum: f039f89ad2658524819543ff4a370e409053bfd3b4851be82c3cceb6fcd39e954a1ca3bfd13e99fbd1f7fbb9cd69ed28545a852c8dbca2e8300eec23586767a4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@docusaurus/plugin-content-blog@npm:2.4.3":
|
||||
version: 2.4.3
|
||||
resolution: "@docusaurus/plugin-content-blog@npm:2.4.3"
|
||||
@ -6396,6 +6416,7 @@ __metadata:
|
||||
dependencies:
|
||||
"@docusaurus/core": 2.4.3
|
||||
"@docusaurus/module-type-aliases": 2.4.3
|
||||
"@docusaurus/plugin-client-redirects": 2.4.3
|
||||
"@docusaurus/preset-classic": 2.4.3
|
||||
"@fortawesome/fontawesome-svg-core": 6.4.2
|
||||
"@fortawesome/free-brands-svg-icons": 6.4.2
|
||||
|
Loading…
Reference in New Issue
Block a user