mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-17 02:02:38 +02:00
polish(v2): improve Docusaurus 1 to 2 migration developer experience (#2884)
* improve markdown parsing errors by adding file path to error * typo commit * Add default nav item position to right (as v1) * improve error when sidebar references unexisting document * parseMarkdownFile: improve errors by providing hint about using "" to avoid parsing errors, if using special characters * improve subcategory migration error for Unknown sidebar item type * improve unrecognizedFields error * typo * fix inline snapshots * improve the migration docs * improve the migration docs * improve migration doc * Update migrating-from-v1-to-v2.md Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
This commit is contained in:
parent
8aa520c314
commit
1003a15d1f
11 changed files with 195 additions and 46 deletions
|
@ -275,16 +275,18 @@ export default function pluginContentDocs(
|
|||
});
|
||||
|
||||
const convertDocLink = (item: SidebarItemDoc): SidebarItemLink => {
|
||||
const linkID = item.id;
|
||||
const linkMetadata = docsMetadataRaw[linkID];
|
||||
const docId = item.id;
|
||||
const docMetadata = docsMetadataRaw[docId];
|
||||
|
||||
if (!linkMetadata) {
|
||||
if (!docMetadata) {
|
||||
throw new Error(
|
||||
`Improper sidebars file, document with id '${linkID}' not found.`,
|
||||
`Bad sidebars file. The document id '${docId}' was used in the sidebar, but no document with this id could be found.
|
||||
Available document ids=
|
||||
- ${Object.keys(docsMetadataRaw).sort().join('\n- ')}`,
|
||||
);
|
||||
}
|
||||
|
||||
const {title, permalink, sidebar_label} = linkMetadata;
|
||||
const {title, permalink, sidebar_label} = docMetadata;
|
||||
|
||||
return {
|
||||
type: 'link',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue