Commit graph

129 commits

Author SHA1 Message Date
tokarchyn
98a4b3a65c
feat(v2): Add playgroundPosition config for live codeblock (#4328)
* docs(v2): Add configuration parameter to allow putting Result before Editor in @docusaurus/theme-live-codeblock

* update doc

* refactor as playgroundPosition

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-03-05 14:49:17 +01:00
Sébastien Lorber
7c2b81f5b6
fix(v2): website editUrl should target upstream docs (#4233) 2021-02-17 13:02:11 +01:00
Sébastien Lorber
1b3c9be530
chore(v2): setup for i18n staging deployment (#4214) 2021-02-11 12:31:50 +01:00
Sébastien Lorber
be7b5dca78
feat(v2): editUrl function for advanced use-cases (#4121)
* EditUrl function

* normalize blog/docs regarding the editUrl feature + editUrl function

* editUrl fn => always inject posix style relative paths, make tests more reliable
(see also https://github.com/facebook/docusaurus/issues/4124)

* fix editUrl on windows
2021-01-29 15:35:25 +01:00
Sébastien Lorber
a8ee7fd3e8
docs(v2): i18n doc + polish (#4014)
* add some initial i18n doc

* i18n doc progress

* i18n tutorial progress

* i18n tutorial progress

* polish Crowdin docs

* i18n sidebar in guides

* polish crowdin doc

* update Crowdin doc a bit

* fix annoying relative link to global site resource in template (breaks i18n tutorial)

* template: use simpler export for homepage

* add markdown page example

* rename mdx.md to interactiveDoc.mdx

* update bootstrap/facebook templates too

* sync init template package scripts

* add slug frontmatter doc

* improve i18n doc

* complete i18n doc

* temporarily enable the localeDropdown

* doc typo

* improve the i18n doc

* Add Git i18n doc

* add missing "--" for npm run options (unfortunately they don't get stripped by npm2yarn, and are required foor npm)

* improve a bit the Crowdin doc
2021-01-19 17:26:31 +01:00
Joel Marcey
827de9a840
feat: add new policy links to Docusaurus site and FB template (#4019) 2021-01-10 14:07:59 +08:00
Sébastien Lorber
b5c46bd1d9
feat(v2): new docs edit options: editCurrentVersion + editLocalizedDocs (#3949)
* editCurrentVersion initial poc

* ensure edit url allows to edit localized docs

* Add editLocalizedDocs option

* keep editing current version in dev (more convenient)
2020-12-28 10:25:47 +01:00
Sébastien Lorber
aff656182c
feat(v2): Add localeDropdown navbar item type + i18n localeConfigs field (#3916)
* Add localeDropdown navbar item type

* fix type + add localeConfigs test
2020-12-14 18:28:39 +01:00
Sébastien Lorber
8f47babb46
docs(v2): Docs refactoring and reorganization (#3831)
* stable refactor of plugins api documentation

* plugins sidebar not collapsed by default as small?

* theme docs reorg

* Refactor migration guide doc

* fix broken link
2020-11-30 14:07:08 +01:00
Sébastien Lorber
3166fab307
feat(v2): core v2 i18n support + Docusaurus site Crowdin integration (#3325)
* docs i18n initial poc

* docs i18n initial poc

* docs i18n initial poc

* docs i18n initial poc

* crowdin-v2 attempt

* fix source

* use crowdin env variable

* try to install crowdin on netlify

* try to install crowdin on netlify

* try to use crowdin jar directly

* try to curl the crowdin jar

* add java version cmd

* try to run crowdin jar in netlify

* fix translatedDocsDirPath

* fix loadContext issue due to site baseUrl not being modified in generted config file

* real validateLocalesFile

* add locale option to deploy command

* better LocalizationFile type

* create util getPluginI18nPath

* better core localization context loading code

* More explicit VersionMetadata type for localized docs folders

* Ability to translate blog posts with Crowdin!

* blog: refactor markdown loader + report broken links + try to get linkify working better

* upgrade crowdin config to upload all docs folder files except source code related files

* try to support translated pages

* make markdown pages translation work

* add write-translations cli command template

* fix site not  reloaded with correct options

* refactor a bit the read/write of @generated/i18n.json file

* Add <Translate> + translate() API + use it on the docusaurus homepage

* watch locale translation dir

* early POC of adding babel parsing for translation extraction

* fs.stat => pathExists

* add install:fast script

* TSC: noUnusedLocals false as it's already checked  by eslint

* POC of extracting translations from source code

* minor typo

* fix extracted key to code

* initial docs extracted translations

* stable plugin translations POC

* add crowdin commands

* quickfix for i18n deployment

* POC  of themeConfig translation

* add ability to have localized site without path prefix

* sidebar typo

* refactor translation system to output multiple translation files

* translate properly  the docs plugin

* improve theme classic translation

* rework translation extractor to handle new Chrome I18n JSON format (include id/description)

* writeTranslations: allow to pass locales cli arg

* fix ThemeConfig TS issues

* fix localizePath errors

* temporary add write-translations to netlify deploy preview

* complete example of french translated folder

* update fr folder

* remove all translations from repo

* minor translation  refactors

* fix all docs-related tests

* fix blog feed tests

* fix last blog tests

* refactor i18n context a bit, extract codeTranslations in an extra generated file

* improve @generated/i18n type

* fix some i18n todos

* minor refactor

* fix logo typing issue after merge

* move i18n.json to siteConfig instead

* try to fix windows CI build

* fix config test

* attempt to fix windows non-posix path

* increase v1 minify css jest timeout due to flaky test

* proper support for localizePath on windows

* remove non-functional install:fast

* docs, fix docsDirPathLocalized

* fix Docs i18n / md linkify issues

* ensure theme-classic swizzling will use "nextjs" sources (transpiled less aggressively, to make them human readable)

* fix some snapshots

* improve themeConfig translation code

* refactor a bit getPluginI18nPath

* readTranslationFileContent => ensure files are valid, fail fast

* fix versions tests

* add extractSourceCodeAstTranslations comments/resource links

* ignore eslint: packages/docusaurus-theme-classic/lib-next/

* fix windows CI with cross-env

* crowdin ignore .DS_Store

* improve writeTranslations + add exhaustive tests for translations.ts

* remove typo

* Wire currentLocale to algolia search

* improve i18n locale error

* Add tests for translationsExtractor.ts

* better code translation extraction regarding statically evaluable code

* fix typo

* fix typo

* improve theme-classic transpilation

* refactor  +  add i18n tests

* typo

* test new utils

* add missing snapshots

* fix snapshot

* blog onBrokenMarkdownLink

* add sidebars tests

* theme-classic index should now use ES modules

* tests for theme-classic translations

* useless comment

* add more translation tests

* simplify/cleanup writeTranslations

* try to fix Netlify fr deployment

* blog: test translated md is used during feed generation

* blog: better i18n tests regarding editUrl + md translation application

* more i18n tests for docs plugin

* more i18n tests for docs plugin

* Add tests for pages i18n

* polish docusaurus build i18n logs
2020-11-26 12:16:46 +01:00
Sébastien Lorber
746a19f25b
feat(v2): add baseUrlIssueBanner configuration to disable banner (#3802)
* add baseUrlIssueBanner configuration

* handle review
2020-11-23 20:54:13 +03:00
Alexey Pyltsyn
3aeb90fcac
feat(v2): add support for sync to npm2yarn tabs (#3705) 2020-11-06 17:30:32 +01:00
iAmir
8f2d898f22
feat(v2): onBrokenMarkdownLinks config (#3658)
* refactor(v2): move `reportMessage` from `core/src/server/utils` to `utils` package

* feat(v2): handle broken markdown links by using onBrokenLinks prop from siteconfig

* feat(v2): add a new site config prop called `onBrokenMarkdownLinks`

works like onBrokenLinks, but only for markdown links

* feat(v2): add `onBrokenMarkdownLinks` to API docs

* some changes regarding test issues after adding `onBrokenMarkdownLink`

* Update website/versioned_docs/version-2.0.0-alpha.66/api/docusaurus.config.js.md

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2020-10-31 18:04:56 +01:00
Alexey Pyltsyn
14cdd72ae4
feat(v2): add ability to hide doc sidebar (#3615)
* feat(v2): add ability to hide doc sidebar

* Use relative imports
2020-10-22 11:23:15 +02:00
Sébastien Lorber
e4c1626106
feat(v2): blog sidebar (#3593)
* blog sidebar POC

* polish blog post sidebar

* add doc for blogSidebarCount

* Update packages/docusaurus-theme-classic/src/theme/BlogSidebar/styles.module.css

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
2020-10-16 19:12:05 +02:00
Fanny
4760e1225b
feat(v2): Extract npm2yarn plugin (#3469)
* chore(v2): add dependency

* test(v2): Add npm2yarn tests

* feat(v2): Move npm2yarn to a new remark plugin

* remark npm2yarn plugin => ready to release

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2020-10-15 19:30:12 +02:00
Sébastien Lorber
aed1ce7850
chore(v2): enable new contextual search feature (#3591) 2020-10-15 15:34:04 +02:00
Sébastien Lorber
21264f5ed0
feat(v2): contextual search, dynamic Algolia facetFilters (#3550)
* POC of contextual search dynamic filters

* fix useSearchTags bugs

* contextual search should use preferred version  (persisted in storage)

* Contextual search: make system decoupled from algolia + wire proper meta tags and facet filters

* rework doc tag + minor refactorings

* update snapshots

* polish contextual search

* add Algolia validateThemeConfig tests
2020-10-15 12:16:30 +02:00
Alexey Pyltsyn
39d6787471
fix(v2): use absolute path to manifest file (#3554)
* fix(v2): use absolute path to manifest file

* Use base url
2020-10-08 18:27:26 +02:00
Sébastien Lorber
649882d867
feat(v2): version dropdown before/after items + move site "All Versions" link (#3548)
* add dropdownItemsAfter option + reorg a bit docusaurus site navbar

* fix isActive  react warning

* Update theme-classic.md

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
2020-10-07 19:58:00 +03:00
Sébastien Lorber
5b79f2ebc2
feat(v2): site client modules (#3545)
* site client modules

* Update website/docs/api/docusaurus.config.js.md

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
2020-10-07 14:44:14 +03:00
Sébastien Lorber
9ba28a378f
feat(v2): doc navbar item type (#3539)
* provide DocNavbarItem type

* update snapshots

* Fix Docusaurus tabs CSS

* revert navbar tabs css/style changes, instead apply simple navbar__link--active class + make it configurable

* Update website/docs/theme-classic.md

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>

* add dropdownActiveClassDisabled option

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
2020-10-07 14:42:24 +03:00
Sébastien Lorber
85ff9bd33a
chore(v2): v2 website should make it easy to contribute to upstream docs (#3506)
* To incitate to contribute to upstream docs, we could set the upstream docs the main docs so that editUrl will modify upstream docs in priority

* add unreleased label instead of next
2020-10-01 16:13:11 +02:00
Bartosz Kaszubowski
ae2c063929
feat(v2): allow to use array of files in customCss field (#3474)
* feat(v2): allow to use array of files in customCss field

* customCss array:
- fix bug (push instead of concat)
- update docs
- add theme config validation + tests

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2020-09-28 18:15:41 +02:00
Ash
37989a00c3
fix(v2): Correctly resolve sw.js path on windows (#3436)
* fix(v2): Correctly resolve sw.js path on windows

* Just fixing the icons too

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2020-09-11 15:19:11 +02:00
Sébastien Lorber
21852948ce
feat(v2): ability to add/override theme html metadatas (#3406)
* ability to add/override theme html metadatas
see https://github.com/facebook/docusaurus/issues/3024

* refactor/fix validateThemeConfig tests
2020-09-04 16:36:56 +02:00
Sébastien Lorber
0baf3c2e54
fix(v2): DocSearch should keep working after a new release (part 2/2) (#3397) 2020-09-03 17:28:24 +02:00
Sébastien Lorber
9c34f68a7a
fix(v2): DocSearch should keep working after a new release (#3393)
* We should create an alias for searching last version of docs on DocSearch/Algolia, so that on new version publish, search still works even if new version is not already indexed (https://github.com/facebook/docusaurus/issues/3391)

* commit missing snapshot

* update after algolia changes

* put back facetFilters: [`version:${versions[0]}`] until latest facet is indexed
2020-09-03 14:35:46 +02:00
Sébastien Lorber
a4769e3f30
fix(v2): alpha 62 doc fixes (#3381)
* deprecated nextVersionLabel option

* useActivePlugin failfast option

* remove deprecated option nextVersionLabel

* routeBasePath: '' should be forbidden

* routeBasePath: '' should be forbidden

* Docs: do not show version badge if there is only 1 version: https://github.com/facebook/docusaurus/issues/3362

* allow sidebars file to not exist: fallback to empty sidebars
https://githu.com/facebook/docusaurus/issues/3366
2020-09-01 16:31:33 +02:00
Sébastien Lorber
d8cfabb66a
feat(v2): docs options.onlyIncludeVersions (#3373)
* docs options.onlyIncludeVersions

* adapt docsVersionDropdown if we render a single version

* fix bad error message

* fix netlify deploy when versioning is disabled
2020-08-31 17:08:24 +02:00
Sébastien Lorber
ae877f2990
feat(v2): docs version configuration: lastVersion, version.{path,label} (#3357)
* add new docs versioning options

* Add some tests for new versioning options

* Add some docs for version configurations

* try to fix broken link detection after /docs/ root paths have been removed on deploy previews

* improve dev/deploypreview versioning configurations

* disable custom current version path, as it produces broken links

* readVersionDocs should not be order sensitive

* fix versions page according to versioning config

* fix versions page according to versioning config
2020-08-28 18:37:49 +02:00
Fanny
8c05aa8e94
feat(v2): bootstrap theme, preset, template, CI previews (#2981)
* fix(v2): doc sidebar

* chore(v2): prettier

* fix(v2): docs navbar path

* fix(v2): fix error about activepath

* chore(v2): prettier

* feat(v2): change active color

* feat(v2): Add bootstrap doc

* docs(v2): Update preset

* doc(v2): finish bootstrap documentation

* chore(v2): run lint

* doc(v2): update hook

* fix theme bootstrap layout (far from perfect)

* Try to fix bootstrap theme and deploy it!

* fix netlify error

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2020-08-17 20:18:37 +02:00
Sébastien Lorber
fe281a8ebe
feat(v2): debug pages + debug layout + ability to debug content (#3229)
* improve debug plugin:
- add multiple debug pages + debug layout
- ability to debug plugin contentLoaded data

* add missing dependency

* fix broken test

* improve content rendering a bit

* create basic DebugJsonView

* fix ReactJson SSR issues
2020-08-07 11:47:43 +02:00
Sébastien Lorber
0a33a52301
fix(v2): deprecate docs homePageId in favor of frontmatter "slug: /" (#3228)
* homePageId => deprecated

* docs prettier
2020-08-06 18:31:50 +02:00
Sébastien Lorber
59f705ee66
feat(v2): blog + docs multi-instance plugins (#3204)
* stable createData namespacing + second-blog dogfooding

* Docs: support multi-instance + make community docs a separate instance

* tests: add 2nd docs instance to versioned site

* fix docs version cli tests

* fix docs versioning cli

* typo

* team: add link to my site

* better extendCli integration

* fix metadata tests

* tests for versioned site with second docs instance

* move some validation code to utils-validation

* fix missing dependency

* fix bad compiled output due to importing constants in ./client folder

* make docs tests easier to maintain

* refactors

* prevent lodash imports in client bundle

* redirect old community docs to new urls
2020-08-05 18:27:55 +02:00
Sébastien Lorber
7cceee7e38
feat(v2): markdown pages (#3158)
* markdown pages POC

* add remark admonition, mdx provider, yarn2npm...

* pluginContentPages md/mdx tests

* pluginContentPages md/mdx tests

* add relative file path test link to showcase link problem

* fix Markdown pages issues after merge

* fix broken links found in markdown pages

* fix tests

* factorize common validation in @docusaurus/utils-validation

* add some documentation

* add using plugins doc

* minor md pages fixes
2020-07-31 16:04:56 +02:00
François Chalifour
298522ff66
feat(v2): introduce DocSearch v3 search (#2815)
* feat(v2): introduce DocSearch v3 search

* chore(deps): update @docsearch/react

* refactor: use arrow functions in callbacks

* fix: display warning when `algolia` config is missing

* feat: add link to search page

* chore: delete unused style file

* feat(website): specify DocSearch primary color

* fix(search): add "all" word

* feat(search): add `generateSearchPageHref` hook

* chore(deps): update @docsearch/react

* fix(website): remove `hitsPerPage` search parameter

* fix(search): use `baseUrl`

* fix(search): rename `generateSearchPageLink`

* fix(search): fix scroll position on mobile

* fix(search): update query on URL change

* fix(search): close DocSearch modal on See More click

* refactor(search): use `useSearchQuery` to update query from URL

* feat(search): support `/` keyboard shortcut

* fix(search): forward Algolia config to DocSearch

* chore(search): update `@docsearch/react`

* fix(search): encode search value to search page

* fix(search): use `withBaseUrl` on links

* feat(search): attach Docusaurus version to user agents

* docs(docsearch): update DocSearch section

* chore(deps): update @docsearch/react

* feat(search): apply search styles to website

* docs(search): update DocSearch doc

* chore(deps): update @docsearch/react

* chore: update lock file

* chore(deps): update algoliasearch

* fix(website): remove special character in CSS

* docs(search): remove special character in CSS
2020-07-23 14:36:38 +02:00
Sébastien Lorber
811c7ae4e9
fix(v2): fix recent baseurl issues (#3093)
* try to fix the baseUrl related issues

* fix some newly detected broken links

* fix baseurl and broken link issues

* try to configure netlify to use baseUrl deployment

* add proper netlify settings?

* add proper netlify settings?

* add proper netlify settings?

* test commit

* try to fix the redirects

* cleanup working conf

* minor redirect fix
2020-07-22 19:55:40 +02:00
Sébastien Lorber
27f384a67c
refactor(v2): improve navbar menu + generated config should be normalized (#3088)
* improve navbar menu

* fix errors due to forcePrependBaseUrl being normalized to true

* fix TS errors
2020-07-22 11:56:28 +02:00
Sébastien Lorber
8ff28e3fe4
feat(v2): broken links detection (#3059)
* add broken links checker

* polish

* finalize broken links detection feature

* note broken links is only for prod build

* fix broken link on template

* fix test snapshot

* fix bad merge
2020-07-21 19:13:34 +02:00
Sébastien Lorber
15e73daae7
feat(v2): global data + useGlobalData + docs versions dropdown (#2971)
* doc components initial simplification

* doc components initial simplification

* add docContext test

* Add poc of global data system + use it in the theme

* Revert "doc components initial simplification"

This reverts commit f657b4c4

* revert useless changes

* avoid loosing context on docs switch

* fix docs tests

* fix @generated/globalData ts declaration / es import

* typo

* revert bad commit

* refactor navbar in multiple parts + add navbar item types validation + try to fix remaining merge bugs

* add missing watch mode for plugin debug

* fix docs global data integration, move related hooks to docs plugin + convert to TS

* change versions link label

* fix activeClassName react warning

* improve docs global data system + contextual navbar dropdown

* fix bug preventing the deployment

* refactor the global data system to namespace automatically by plugin name + plugin id

* proper NavbarItem comp

* fix tests

* fix snapshot

* extract theme config schema in separate file + rename navbar links to navbar items

* minor typos

* polish docs components/api

* polish useDocs api surface

* fix the docs version suggestions comp + data

* refactors + add docsClientUtils unit tests

* Add documentation

* typo

* Add check for duplicate plugin ids detection

* multi-instance: createData plugin data should be namespaced by plugin instance id

* remove attempt for multi-instance support
2020-07-21 11:16:08 +02:00
Jeremy Asuncion
9b3da59886
feat(v2): Plugin for Offline/PWA support (#2205)
* implement PWA plugin

* added pwa support for docusaurus website

* moved sw registration to client module

* moved compile function to webpack util

* build sw using webpack and render pwa popup

* implement @theme/PwaReloadPopup

* update website sw to use modules

* updated pwa readme

* fix header lint errors

* apply code formatting

* cache files only for mobile, saveData, or installed pwa

* added comments about clearing registrations

* fixed prettier error

* updated pwa README

* fix README JS

* move /blog => /blog/index.html logic to else branch

* add `alwaysPrecache` option

* updated docusaurus-plugin-pwa version

* added pwa to using-plugins.md

* review fixes

* re-disable restricted-globals to use self in service worker

* useless doc

* Update packages/docusaurus-plugin-pwa/README.md

Co-authored-by: Reece Dunham <me@rdil.rocks>

* Update packages/docusaurus-plugin-pwa/README.md

* update a bit pwa doc + minor refactors

* minor refactors + add workbox debug mode

* env PWA_ prefix

* typo

* minor refactor

* fix file output

* add serve:v2:ssl yarn command

* minor pwa fixes

* typo

* add dynamic import comment in SW

* comment

* let the PWA plugin implement its reload popup on his own

* pwa: add Joi options validation

* pwa plugin should have its own webpack/babel custom setup

* PWA:
- debug logs
- better SW params system
- offline mode activation strategies
- docs

* add pwa install gif

* pwa: popup -> reloadPopup + minor refactors

* fix process.env reading + better debug log

* minor fixes

* minor changes

* minor changes

Co-authored-by: slorber <lorber.sebastien@gmail.com>
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
Co-authored-by: Reece Dunham <me@rdil.rocks>
2020-07-08 12:32:41 +02:00
Sébastien Lorber
a5b2b6056b
feat(v2): add disableVersioning config to docs plugin (#2989)
* add disableVersioning config to docs plugin

* fix test

* fix test
2020-07-01 19:03:59 +02:00
Sébastien Lorber
c2bb03ab00
fix(v2): refactor color mode system (#3012)
* refactor color mode system to enable all possibilities

* fix destructuring bug

* colorMode validation + deprecation + minor name changes + doc

* rename method noFlashColorMode

* fix doc wording

* docs wording

* docs wording

* re-enable theme config merging/normalization + colorMode fixes

* document theme normalization

* code review changes
2020-06-30 12:21:20 +02:00
Teik Jun
2e055f4ae2
fix(v2): make client-redirect-plugin not baseUrl sensitive (#3010)
* feat(v2): use relative routes path in postBuild hook

* feat(v2): use relativeRoutesPath in other methods and modify tests

* fix(v2): fix D2 client redirects and tests

* feat(v2): add tests for relativeRoutesPaths

* fix(v2): fix some typos in configValidation

* fix(v2): fix an eslint warning and restart github action

* refactor(v2): create a removePrefix method

* refactor(v2): inline unnecessary method
2020-06-29 18:38:28 +02:00
slorber
c964a1e3b6 add introduction redirect 2020-06-10 17:22:08 +02:00
slorber
a02f90c064 Merge branch 'master' into feature/client-side-redirects 2020-06-04 11:42:00 +02:00
Alexey Pyltsyn
5c6670b94e fix(v2): fix broken URL to introduction 2020-06-04 03:38:01 +03:00
slorber
00a79f69c7 Add chalk non-blocking errors + fix config bug 2020-06-03 19:28:57 +02:00
slorber
77c7ac0ddb add more redirect tests to d2 site config 2020-06-03 18:15:12 +02:00