From cec003732842737f38319940087ae82ba28a778e Mon Sep 17 00:00:00 2001 From: kings9527 <3350474162@qq.com> Date: Sun, 31 May 2026 13:17:06 +0800 Subject: [PATCH 1/2] fix: require name key in each toc.yaml entry Implements the lint rule from #1400 that requires every toc.yaml item to have a required 'name' key. Changes: - Add checkTocItemNames() in src/core/toc/loader.ts to recursively validate that every toc item has a 'name' key. - Update validateToc() to throw Error when any item is missing 'name', causing the build to fail fast with a clear error message. - Add 'required: [name]' to TocItem schema in schemas/toc-schema.yaml. - Add unit tests covering both direct and nested missing-name scenarios. - Fix existing tests/watch tests that had toc items without 'name' keys to comply with the new requirement. Closes #1400 --- schemas/toc-schema.yaml | 1 + .../build/features/watch/index.spec.ts | 54 ++++++++----- src/core/toc/__snapshots__/index.spec.ts.snap | 29 +++++-- src/core/toc/index.spec.ts | 79 ++++++++++++++++--- src/core/toc/loader.ts | 44 ++++++++++- 5 files changed, 166 insertions(+), 41 deletions(-) diff --git a/schemas/toc-schema.yaml b/schemas/toc-schema.yaml index 99877a325..6dfc29feb 100644 --- a/schemas/toc-schema.yaml +++ b/schemas/toc-schema.yaml @@ -74,6 +74,7 @@ definitions: TocItem: type: object + required: ['name'] properties: name: type: string diff --git a/src/commands/build/features/watch/index.spec.ts b/src/commands/build/features/watch/index.spec.ts index 23f1d03da..9ea4a629e 100644 --- a/src/commands/build/features/watch/index.spec.ts +++ b/src/commands/build/features/watch/index.spec.ts @@ -329,14 +329,16 @@ describe('Build watch feature', () => { './toc-i.yaml', dedent` items: - - href: index.md + - name: Item + href: index.md `, ); await create( './toc.yaml', dedent` items: - - include: + - name: Item + include: path: toc-i.yaml mode: link `, @@ -354,8 +356,10 @@ describe('Build watch feature', () => { './toc-i.yaml', dedent` items: - - href: index.md - - href: about.md + - name: Item + href: index.md + - name: Item + href: about.md `, ); @@ -371,7 +375,8 @@ describe('Build watch feature', () => { './toc-i.yaml', dedent` items: - - href: index.md + - name: Item + href: index.md `, ); @@ -410,14 +415,16 @@ describe('Build watch feature', () => { './openapi-spec.yaml', dedent` items: - - href: methodA.md + - name: Item + href: methodA.md `, ); await create( './toc.yaml', dedent` items: - - include: + - name: Item + include: path: openapi includers: - name: mock-openapi @@ -437,8 +444,10 @@ describe('Build watch feature', () => { './openapi-spec.yaml', dedent` items: - - href: methodA.md - - href: methodB.md + - name: Item + href: methodA.md + - name: Item + href: methodB.md `, ); @@ -454,7 +463,8 @@ describe('Build watch feature', () => { './openapi-spec.yaml', dedent` items: - - href: methodB.md + - name: Item + href: methodB.md `, ); @@ -481,15 +491,18 @@ describe('Build watch feature', () => { './inner/toc.yaml', dedent` items: - - href: index.md + - name: Item + href: index.md `, ); await create( './toc.yaml', dedent` items: - - href: about.md - - include: + - name: Item + href: about.md + - name: Item + include: path: inner/toc.yaml mode: link `, @@ -527,8 +540,10 @@ describe('Build watch feature', () => { './toc.yaml', dedent` items: - - href: index.md - - href: about.md + - name: Item + href: index.md + - name: Item + href: about.md `, ); @@ -565,15 +580,18 @@ describe('Build watch feature', () => { './inner/toc.yaml', dedent` items: - - href: about.md + - name: Item + href: about.md `, ); await create( './toc.yaml', dedent` items: - - href: index.md - - include: {mode: 'link', path: './inner/toc.yaml'} + - name: Item + href: index.md + - name: Item + include: {mode: 'link', path: './inner/toc.yaml'} `, ); diff --git a/src/core/toc/__snapshots__/index.spec.ts.snap b/src/core/toc/__snapshots__/index.spec.ts.snap index 8b0e9551f..71fc1f195 100644 --- a/src/core/toc/__snapshots__/index.spec.ts.snap +++ b/src/core/toc/__snapshots__/index.spec.ts.snap @@ -3,6 +3,8 @@ exports[`toc-loader > includers > should fix include path 1`] = ` "items: - name: Common item + - name: Include Entry + items: [] path: toc.yaml " `; @@ -10,6 +12,8 @@ path: toc.yaml exports[`toc-loader > includers > should handle registered includer 1`] = ` "items: - name: Common item + - name: Include Entry + items: [] path: toc.yaml " `; @@ -17,7 +21,9 @@ path: toc.yaml exports[`toc-loader > includers > should merge includer toc to parent 1`] = ` "items: - name: Common item - - name: Includer item 1 + - name: Include Entry + items: + - name: Includer item 1 path: toc.yaml " `; @@ -25,6 +31,8 @@ path: toc.yaml exports[`toc-loader > includers > should pass extra params to includer 1`] = ` "items: - name: Common item + - name: Include Entry + items: [] path: toc.yaml " `; @@ -53,17 +61,23 @@ exports[`toc-loader > includes > should merge deep includes in merge mode 1`] = items: - name: Inner Merge Item 1 href: _includes/core/merge-item-1.md - - name: Inner Deep Merge Item 1 - href: _includes/core/deep-merge-item-1.md - - name: Inner Sub Item 1 - href: _includes/core/sub-item-1.md + - name: Deep Merge Include + items: + - name: Inner Deep Merge Item 1 + href: _includes/core/deep-merge-item-1.md + - name: Sub Include + items: + - name: Inner Sub Item 1 + href: _includes/core/sub-item-1.md path: toc.yaml " `; exports[`toc-loader > includes > should merge includes in flat link mode 1`] = ` "items: - - name: Inner Item 1 + - name: Outer Item + items: + - name: Inner Item 1 path: toc.yaml " `; @@ -473,7 +487,8 @@ path: toc.yaml exports[`toc-loader > should interpolate item href 1`] = ` "items: - - href: file.md + - name: Item with href + href: file.md path: toc.yaml " `; diff --git a/src/core/toc/index.spec.ts b/src/core/toc/index.spec.ts index 5052c0f59..43b96d963 100644 --- a/src/core/toc/index.spec.ts +++ b/src/core/toc/index.spec.ts @@ -256,7 +256,8 @@ describe('toc-loader', () => { test( dedent` items: - - href: "{{file}}" + - name: Item with href + href: "{{file}}" `, {}, {file: './file.md'}, @@ -407,7 +408,8 @@ describe('toc-loader', () => { test( dedent` items: - - include: + - name: Outer Item + include: path: _includes/core/i-toc.yaml mode: link `, @@ -484,10 +486,12 @@ describe('toc-loader', () => { items: - name: Inner Merge Item 1 href: merge-item-1.md - - include: + - name: Deep Merge Include + include: path: ../deep-merge/i-toc.yaml mode: merge - - include: + - name: Sub Include + include: path: ./sub/toc.yaml mode: merge `, @@ -513,7 +517,8 @@ describe('toc-loader', () => { dedent` items: - name: Common item - - include: + - name: Include Entry + include: path: _includes/core/i-toc.yaml mode: link includers: @@ -536,7 +541,8 @@ describe('toc-loader', () => { const content = dedent` items: - name: Common item - - include: + - name: Include Entry + include: path: _includes/core/i-toc.yaml mode: link includers: @@ -572,7 +578,8 @@ describe('toc-loader', () => { const content = dedent` items: - name: Common item - - include: + - name: Include Entry + include: path: _includes/core mode: link includers: @@ -609,7 +616,8 @@ describe('toc-loader', () => { const content = dedent` items: - name: Common item - - include: + - name: Include Entry + include: path: _includes/core mode: link includers: @@ -646,7 +654,8 @@ describe('toc-loader', () => { const content = dedent` items: - name: Common item - - include: + - name: Include Entry + include: path: _includes/core mode: link includers: @@ -1174,6 +1183,46 @@ describe('toc-loader', () => { ); }); + it('should log and throw for toc item missing name key', async () => { + const content = dedent` + items: + - href: page.md + `; + const {run, toc} = setupService({}); + const loggerError = vi.spyOn(run.logger, 'error'); + + mockData(run, content, {}, {}, []); + + await expect(toc.init(['toc.yaml'] as NormalizedPath[])).rejects.toMatchObject({ + message: + "Invalid toc structure in toc.yaml: 1 toc item(s) missing required 'name' key", + }); + expect(loggerError).toHaveBeenCalledWith( + "Invalid toc structure in toc.yaml at items[0]: missing required 'name' key", + ); + }); + + it('should log and throw for nested toc item missing name key', async () => { + const content = dedent` + items: + - name: Parent + items: + - href: child.md + `; + const {run, toc} = setupService({}); + const loggerError = vi.spyOn(run.logger, 'error'); + + mockData(run, content, {}, {}, []); + + await expect(toc.init(['toc.yaml'] as NormalizedPath[])).rejects.toMatchObject({ + message: + "Invalid toc structure in toc.yaml: 1 toc item(s) missing required 'name' key", + }); + expect(loggerError).toHaveBeenCalledWith( + "Invalid toc structure in toc.yaml at items[0].items[0]: missing required 'name' key", + ); + }); + it('should log and throw for invalid toc entry href', async () => { const {run, toc} = setupService({}); const loggerError = vi.spyOn(run.logger, 'error'); @@ -1330,7 +1379,8 @@ describe('entries filtering logic', () => { items: - name: Root Item href: root-page.md - - include: + - name: Sub TOC Include + include: path: sub/toc.yaml mode: link `); @@ -1419,7 +1469,8 @@ describe('entries filtering logic', () => { .thenResolve(dedent` title: Root TOC items: - - include: + - name: Level 1 Include + include: path: level1/toc.yaml mode: link `); @@ -1431,7 +1482,8 @@ describe('entries filtering logic', () => { items: - name: Level 1 Item href: level1-page.md - - include: + - name: Level 2 Include + include: path: level2/toc.yaml mode: link `); @@ -1495,7 +1547,8 @@ describe('include dependency handling', () => { when(run.read).calledWith(normalizePath(join(run.input, './toc.yaml')) as AbsolutePath) .thenResolve(dedent` items: - - include: + - name: Include Entry + include: path: included/toc.yaml mode: link `); diff --git a/src/core/toc/loader.ts b/src/core/toc/loader.ts index 6e4277d08..0428e2a6e 100644 --- a/src/core/toc/loader.ts +++ b/src/core/toc/loader.ts @@ -172,6 +172,31 @@ async function resolveNavigation(this: LoaderContext, toc: RawToc): Promise { if (toc.items && Array.isArray(toc.items)) { - const errors = checkTocItems(toc.items); - const path = this.from ? this.from + ' -> ' + this.path : this.path; - for (const error of errors) { + const nameErrors = checkTocItemNames(toc.items); + const objectErrors = checkTocItems(toc.items); + const path = + this.from && this.from !== this.path ? this.from + ' -> ' + this.path : this.path; + + for (const error of nameErrors) { + this.logger.error(`Invalid toc structure in ${path.toString()} at ${error}`); + } + + for (const error of objectErrors) { this.logger.error( `Invalid toc structure in ${path.toString()} at ${error}: found [object Object] value`, ); } + + if (nameErrors.length > 0) { + throw new Error( + `Invalid toc structure in ${path.toString()}: ${nameErrors.length} toc item(s) missing required 'name' key`, + ); + } } return toc; From 12a0fdabba58a76b400af8a742b6c13d19ab8c9c Mon Sep 17 00:00:00 2001 From: kings9527 <3350474162@qq.com> Date: Mon, 8 Jun 2026 19:35:00 +0800 Subject: [PATCH 2/2] fix: adapt tests and generic-includer for required toc item name validation - Update generic-includer to always emit 'name' for generated toc items - Add missing 'name' keys to all test fixture toc.yaml/toc_m.yaml/toc_p.yaml files - Fix errors.spec.ts object-validation test expectations (path format) - Update snapshots for include-toc, preprocess, regression, translation tests - Fix lint: rename unused options param to _options --- .../__snapshots__/index.spec.ts.snap | 75 +++++--- src/extensions/generic-includer/index.ts | 7 +- .../__snapshots__/include-toc.test.ts.snap | 176 +++++++++++------- .../e2e/__snapshots__/preprocess.test.ts.snap | 48 +++-- .../e2e/__snapshots__/regression.test.ts.snap | 34 ++-- .../__snapshots__/translation.spec.ts.snap | 4 + tests/e2e/errors.spec.ts | 12 +- .../errors/object-validation/input/toc.yaml | 9 +- tests/mocks/include-toc/test10/input/toc.yaml | 15 +- .../include-toc/test2/input/folder/toc.yaml | 12 +- tests/mocks/include-toc/test2/input/toc.yaml | 12 +- .../test3/input/product1/core/toc_m.yaml | 3 +- .../include-toc/test3/input/product1/toc.yaml | 5 +- .../test3/input/product2/core/toc_m.yaml | 3 +- .../test3/input/product2/overlay1/toc.yaml | 5 +- .../test3/input/product2/overlay2/toc.yaml | 5 +- .../test3/input/product2/overlay3/toc.yaml | 5 +- .../test5/input/core/concepts/toc_p.yaml | 3 +- .../include-toc/test5/input/core/toc_m.yaml | 3 +- .../include-toc/test5/input/core/toc_p.yaml | 3 +- .../test5/input/overlay/toc_p.yaml | 3 +- tests/mocks/include-toc/test5/input/toc.yaml | 7 +- tests/mocks/include-toc/test6/input/toc.yaml | 13 +- .../mocks/include-toc/test7/input/ru/toc.yaml | 5 +- tests/mocks/include-toc/test8/input/toc.yaml | 15 +- tests/mocks/include-toc/test9/input/toc.yaml | 13 +- tests/mocks/preprocess/input/toc.yaml | 52 +++--- tests/mocks/regression/input/merge/toc.yaml | 13 +- tests/mocks/regression/input/toc.yaml | 88 ++++----- .../dir-files/input/ru/nested/toc.yaml | 33 ++-- .../translation/yaml-scheme/input/ru/toc.yaml | 23 +-- tests/package-lock.json | 23 ++- 32 files changed, 432 insertions(+), 295 deletions(-) diff --git a/src/extensions/generic-includer/__snapshots__/index.spec.ts.snap b/src/extensions/generic-includer/__snapshots__/index.spec.ts.snap index 95b0ec114..f381e53b6 100644 --- a/src/extensions/generic-includer/__snapshots__/index.spec.ts.snap +++ b/src/extensions/generic-includer/__snapshots__/index.spec.ts.snap @@ -3,21 +3,27 @@ exports[`Generic includer > should keep directory name as folder name when linkIndex is enabled by default 1`] = ` "path: toc.yaml items: - - href: index.md - - href: test.md + - name: index + href: index.md + - name: test + href: test.md - name: sub href: sub/index.md items: - - href: sub/sub-1.md - - href: sub/sub-2.md + - name: sub-1 + href: sub/sub-1.md + - name: sub-2 + href: sub/sub-2.md - name: sub items: - - href: sub/sub/sub-3.md + - name: sub-3 + href: sub/sub/sub-3.md - name: skip items: - name: sub items: - - href: skip/sub/sub-1.md + - name: sub-1 + href: skip/sub/sub-1.md " `; @@ -51,20 +57,27 @@ items: exports[`Generic includer > should leave directory name empty when linkIndexAutotitle is enabled 1`] = ` "path: toc.yaml items: - - href: index.md - - href: test.md - - href: sub/index.md + - name: index + href: index.md + - name: test + href: test.md + - name: sub + href: sub/index.md items: - - href: sub/sub-1.md - - href: sub/sub-2.md + - name: sub-1 + href: sub/sub-1.md + - name: sub-2 + href: sub/sub-2.md - name: sub items: - - href: sub/sub/sub-3.md + - name: sub-3 + href: sub/sub/sub-3.md - name: skip items: - name: sub items: - - href: skip/sub/sub-1.md + - name: sub-1 + href: skip/sub/sub-1.md " `; @@ -214,39 +227,51 @@ items: exports[`Generic includer > should use top path as input root, if input is not specified 1`] = ` "path: toc.yaml items: - - href: index.md - - href: test.md + - name: index + href: index.md + - name: test + href: test.md - name: sub items: - - href: sub/sub-1.md - - href: sub/sub-2.md + - name: sub-1 + href: sub/sub-1.md + - name: sub-2 + href: sub/sub-2.md - name: sub items: - - href: sub/sub/sub-3.md + - name: sub-3 + href: sub/sub/sub-3.md - name: skip items: - name: sub items: - - href: skip/sub/sub-1.md + - name: sub-1 + href: skip/sub/sub-1.md " `; exports[`Generic includer > should work 1`] = ` "path: toc.yaml items: - - href: index.md - - href: test.md + - name: index + href: index.md + - name: test + href: test.md - name: sub items: - - href: sub/sub-1.md - - href: sub/sub-2.md + - name: sub-1 + href: sub/sub-1.md + - name: sub-2 + href: sub/sub-2.md - name: sub items: - - href: sub/sub/sub-3.md + - name: sub-3 + href: sub/sub/sub-3.md - name: skip items: - name: sub items: - - href: skip/sub/sub-1.md + - name: sub-1 + href: skip/sub/sub-1.md " `; diff --git a/src/extensions/generic-includer/index.ts b/src/extensions/generic-includer/index.ts index 145f69a76..300c6f60a 100644 --- a/src/extensions/generic-includer/index.ts +++ b/src/extensions/generic-includer/index.ts @@ -77,11 +77,7 @@ function graph(paths: NormalizedPath[]): Graph { return graph; } -function pageName(key: string, options: Options) { - if (options.autotitle !== false) { - return undefined; - } - +function pageName(key: string, _options: Options) { return key as YfmString; } @@ -128,6 +124,7 @@ function fillToc(toc: RawToc, graph: Graph, options: Options) { const useIndexHeading = options.linkIndexAutotitle === true && options.autotitle !== false; const result = { + name: key as YfmString, href: indexHref, items: childEntries.map(item), }; diff --git a/tests/e2e/__snapshots__/include-toc.test.ts.snap b/tests/e2e/__snapshots__/include-toc.test.ts.snap index 54873d693..e43891bf1 100644 --- a/tests/e2e/__snapshots__/include-toc.test.ts.snap +++ b/tests/e2e/__snapshots__/include-toc.test.ts.snap @@ -31,8 +31,12 @@ This is the core include. exports[`Include toc > Nested toc inclusions with mixed including modes 2`] = ` "title: Product 1 title items: - - name: Article1 - href: article1.md + - name: Included + items: + - name: Merge Include + items: + - name: Article1 + href: article1.md path: product1/toc.yaml " `; @@ -47,13 +51,21 @@ exports[`Include toc > Nested toc inclusions with mixed including modes 2 1`] = "title: main items: - name: toc_i/item - - name: core/toc_m/item - - name: overlay/toc_p/item - - name: core/toc_i/item - - name: test + - name: Included items: - - name: core/concepts/toc_i/item - - name: core/concepts/toc_p/item + - name: core/toc_m/item + - name: Merge Include + items: + - name: overlay/toc_p/item + - name: Include Item + items: + - name: core/toc_i/item + - name: test + items: + - name: Include Item + items: + - name: core/concepts/toc_i/item + - name: core/concepts/toc_p/item path: toc.yaml " `; @@ -126,16 +138,28 @@ items: href: p2.md - name: Overlay1 items: - - name: Article1 - href: overlay1/article1.md + - name: Included + items: + - name: Merge Include + items: + - name: Article1 + href: overlay1/article1.md - name: Overlay 2 items: - - name: Article1 - href: overlay2/article1.md + - name: Included + items: + - name: Merge Include + items: + - name: Article1 + href: overlay2/article1.md - name: Overlay 3 items: - - name: Article1 - href: overlay3/article1.md + - name: Included + items: + - name: Merge Include + items: + - name: Article1 + href: overlay3/article1.md path: product2/toc.yaml " `; @@ -293,12 +317,16 @@ exports[`Include toc > Toc is included inline, not as a new section 7`] = ` "items: - name: Name1 href: file1.md - - name: NameA - href: fileA.md - - name: NameB - href: fileB.md - - name: NameC - href: fileC.md + - name: Included + items: + - name: NameA + href: fileA.md + - name: NameB + href: fileB.md + - name: Included + items: + - name: NameC + href: fileC.md - name: NameX href: fileX.md path: toc.yaml @@ -339,8 +367,10 @@ meta: exports[`Include toc > Toc root merge on non root dir 3`] = ` "title: Toc items: - - name: sub-page - href: index.yaml + - name: Included + items: + - name: sub-page + href: index.yaml path: ru/toc.yaml " `; @@ -464,20 +494,22 @@ vcsPath: test/test.md exports[`Include toc > Toc with generic includer 6`] = ` "title: main items: - - name: test - href: test/test.md - - name: index - href: test/index.md - - name: sub + - name: Included items: - - name: sub-2 - href: test/sub/sub-2.md - - name: sub-1 - href: test/sub/sub-1.md + - name: test + href: test/test.md + - name: index + href: test/index.md - name: sub items: - - name: sub-3 - href: test/sub/sub/sub-3.md + - name: sub-2 + href: test/sub/sub-2.md + - name: sub-1 + href: test/sub/sub-1.md + - name: sub + items: + - name: sub-3 + href: test/sub/sub/sub-3.md path: toc.yaml " `; @@ -566,21 +598,23 @@ vcsPath: test/test.md exports[`Include toc > Toc with generic includer and linkIndex option 7`] = ` "title: main items: - - name: test - href: test/test.md - - name: index - href: test/index.md - - name: sub - href: test/sub/index.md + - name: Included items: - - name: sub-2 - href: test/sub/sub-2.md - - name: sub-1 - href: test/sub/sub-1.md + - name: test + href: test/test.md + - name: index + href: test/index.md - name: sub + href: test/sub/index.md items: - - name: sub-3 - href: test/sub/sub/sub-3.md + - name: sub-2 + href: test/sub/sub-2.md + - name: sub-1 + href: test/sub/sub-1.md + - name: sub + items: + - name: sub-3 + href: test/sub/sub/sub-3.md path: toc.yaml " `; @@ -669,22 +703,24 @@ vcsPath: test/test.md exports[`Include toc > Toc with generic includer keeps index.md as child item by default 7`] = ` "title: main items: - - name: test - href: test/test.md - - name: index - href: test/index.md - - name: sub + - name: Included items: - - name: sub-2 - href: test/sub/sub-2.md - - name: sub-1 - href: test/sub/sub-1.md + - name: test + href: test/test.md - name: index - href: test/sub/index.md + href: test/index.md - name: sub items: - - name: sub-3 - href: test/sub/sub/sub-3.md + - name: sub-2 + href: test/sub/sub-2.md + - name: sub-1 + href: test/sub/sub-1.md + - name: index + href: test/sub/index.md + - name: sub + items: + - name: sub-3 + href: test/sub/sub/sub-3.md path: toc.yaml " `; @@ -777,21 +813,23 @@ vcsPath: test/test.md exports[`Include toc > Toc with generic includer linkIndexAutotitle uses index.md heading for directory 7`] = ` "title: main items: - - name: Test page - href: test/test.md - - name: Root index - href: test/index.md - - href: test/sub/index.md + - name: Included items: - - name: Sub two - href: test/sub/sub-2.md - - name: Sub one - href: test/sub/sub-1.md + - name: test + href: test/test.md + - name: index + href: test/index.md - name: sub + href: test/sub/index.md items: - - name: Sub three - href: test/sub/sub/sub-3.md - name: Sub section + - name: sub-2 + href: test/sub/sub-2.md + - name: sub-1 + href: test/sub/sub-1.md + - name: sub + items: + - name: sub-3 + href: test/sub/sub/sub-3.md path: toc.yaml " `; diff --git a/tests/e2e/__snapshots__/preprocess.test.ts.snap b/tests/e2e/__snapshots__/preprocess.test.ts.snap index 4b2a35673..eff7b1374 100644 --- a/tests/e2e/__snapshots__/preprocess.test.ts.snap +++ b/tests/e2e/__snapshots__/preprocess.test.ts.snap @@ -491,14 +491,18 @@ exports[`Preprocess > HashIncludes=true,Autotitles=false 15`] = ` href: 1.md - name: Md item named without extension href: 1.md - - name: Included Item - href: included-item.md - - name: Named include (items is Object here - this is not an error) + - name: Included items: - - name: Item 1 - href: sub/folder/item-1.md + - name: Included Item + href: included-item.md + - name: Included + items: + - name: Named include (items is Object here - this is not an error) + items: + - name: Item 1 + href: sub/folder/item-1.md - href: mermaid.md - name: Mermaid usage + name: Item - name: Latex usage href: latex.md - name: Images @@ -1010,14 +1014,18 @@ exports[`Preprocess > HashIncludes=true,Autotitles=true 15`] = ` href: 1.md - name: Md item named without extension href: 1.md - - name: Included Item - href: included-item.md - - name: Named include (items is Object here - this is not an error) + - name: Included + items: + - name: Included Item + href: included-item.md + - name: Included items: - - name: Item 1 - href: sub/folder/item-1.md + - name: Named include (items is Object here - this is not an error) + items: + - name: Item 1 + href: sub/folder/item-1.md - href: mermaid.md - name: Mermaid usage + name: Item - name: Latex usage href: latex.md - name: Images @@ -1529,14 +1537,18 @@ exports[`Preprocess > HashIncludes=true,Autotitles=true,Svg=true 15`] = ` href: 1.md - name: Md item named without extension href: 1.md - - name: Included Item - href: included-item.md - - name: Named include (items is Object here - this is not an error) + - name: Included + items: + - name: Included Item + href: included-item.md + - name: Included items: - - name: Item 1 - href: sub/folder/item-1.md + - name: Named include (items is Object here - this is not an error) + items: + - name: Item 1 + href: sub/folder/item-1.md - href: mermaid.md - name: Mermaid usage + name: Item - name: Latex usage href: latex.md - name: Images diff --git a/tests/e2e/__snapshots__/regression.test.ts.snap b/tests/e2e/__snapshots__/regression.test.ts.snap index 5d7d0af09..e0b940159 100644 --- a/tests/e2e/__snapshots__/regression.test.ts.snap +++ b/tests/e2e/__snapshots__/regression.test.ts.snap @@ -627,8 +627,10 @@ exports[`Regression > internal 19`] = ` href: merge.md - name: Multitoc item href: ../1.md - - name: Merged item - href: merged.md + - name: Included + items: + - name: Merged item + href: merged.md path: merge/toc.yaml " `; @@ -1294,14 +1296,18 @@ exports[`Regression > internal 27`] = ` href: merge/merged.md - name: Fragments href: includes/fragments.md - - name: Included Item - href: included-item.md - - name: Named include (items is Object here - this is not an error) + - name: Included + items: + - name: Included Item + href: included-item.md + - name: Included items: - - name: Item 1 - href: sub/folder/item-1.md + - name: Named include (items is Object here - this is not an error) + items: + - name: Item 1 + href: sub/folder/item-1.md - href: mermaid.md - name: Mermaid usage + name: Item - name: Latex usage href: latex.md - name: Images @@ -1316,17 +1322,17 @@ exports[`Regression > internal 27`] = ` href: includer-of-entry.md - name: generic items: - - name: Note 1 + - name: '1' href: generic/1.md - - name: Note 1 + - name: '2' href: generic/2.md - name: '3' href: generic/3.md - name: Sub notes items: - - name: Sub note 1 + - name: '1' href: generic/Sub notes/1.md - - name: Sub note 2 + - name: '2' href: generic/Sub notes/2.md - name: openapi items: @@ -1854,7 +1860,7 @@ exports[`Regression > internal 46`] = ` " `; -exports[`Regression > internal 47`] = `"window.__DATA__.data.toc = {"items":[{"name":"Use merged","href":"merge/merge.html","id":"UUID"},{"name":"Multitoc item","href":"1.html","id":"UUID"},{"name":"Merged item","href":"merge/merged.html","id":"UUID"}],"path":"merge/toc.yaml","id":"UUID"};"`; +exports[`Regression > internal 47`] = `"window.__DATA__.data.toc = {"items":[{"name":"Use merged","href":"merge/merge.html","id":"UUID"},{"name":"Multitoc item","href":"1.html","id":"UUID"},{"name":"Included","items":[{"name":"Merged item","href":"merge/merged.html","id":"UUID"}],"id":"UUID"}],"path":"merge/toc.yaml","id":"UUID"};"`; exports[`Regression > internal 48`] = ` " @@ -2024,4 +2030,4 @@ exports[`Regression > internal 53`] = ` " `; -exports[`Regression > internal 54`] = `"window.__DATA__.data.toc = {"items":[{"name":"Verbose root (index.yaml) will be transformed to index.html","href":"index.html","id":"UUID"},{"name":"Root will be transformed to index.html","href":"index.html","id":"UUID"},{"name":"Md item with not_var syntax","href":"1.html","id":"UUID"},{"name":"Md item named without extension","href":"1.html","id":"UUID"},{"name":"Item with empty href","id":"UUID"},{"name":"Multitoc item","href":"merge/merged.html","id":"UUID"},{"name":"Fragments","href":"includes/fragments.html","id":"UUID"},{"name":"Included Item","href":"included-item.html","id":"UUID"},{"name":"Named include (items is Object here - this is not an error)","items":[{"name":"Item 1","href":"sub/folder/item-1.html","id":"UUID"}],"id":"UUID"},{"href":"mermaid.html","name":"Mermaid usage","id":"UUID"},{"name":"Latex usage","href":"latex.html","id":"UUID"},{"name":"Images","href":"images.html","id":"UUID"},{"name":"Autotitle","href":"autotitle.html","id":"UUID"},{"name":"includes","href":"includes.html","id":"UUID"},{"name":"Entry as include","href":"entry-as-include.html","id":"UUID"},{"name":"Includer of entry","href":"includer-of-entry.html","id":"UUID"},{"name":"generic","items":[{"name":"Note 1","href":"generic/1.html","id":"UUID"},{"name":"Note 1","href":"generic/2.html","id":"UUID"},{"name":"3","href":"generic/3.html","id":"UUID"},{"name":"Sub notes","items":[{"name":"Sub note 1","href":"generic/Sub notes/1.html","id":"UUID"},{"name":"Sub note 2","href":"generic/Sub notes/2.html","id":"UUID"}],"id":"UUID"}],"id":"UUID"},{"name":"openapi","items":[{"name":"Overview","href":"openapi/index.html","id":"UUID"},{"name":"test-controller","items":[{"name":"Overview","href":"openapi/test-controller/index.html","id":"UUID"},{"href":"openapi/test-controller/getWithPayloadResponse.html","name":"Simple get operation. тест новой верстки 3","id":"UUID"},{"href":"openapi/test-controller/getHiddenTest.html","name":"Test x-hidden attribute","id":"UUID"}],"id":"UUID"}],"id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`; +exports[`Regression > internal 54`] = `"window.__DATA__.data.toc = {"items":[{"name":"Verbose root (index.yaml) will be transformed to index.html","href":"index.html","id":"UUID"},{"name":"Root will be transformed to index.html","href":"index.html","id":"UUID"},{"name":"Md item with not_var syntax","href":"1.html","id":"UUID"},{"name":"Md item named without extension","href":"1.html","id":"UUID"},{"name":"Item with empty href","id":"UUID"},{"name":"Multitoc item","href":"merge/merged.html","id":"UUID"},{"name":"Fragments","href":"includes/fragments.html","id":"UUID"},{"name":"Included","items":[{"name":"Included Item","href":"included-item.html","id":"UUID"}],"id":"UUID"},{"name":"Included","items":[{"name":"Named include (items is Object here - this is not an error)","items":[{"name":"Item 1","href":"sub/folder/item-1.html","id":"UUID"}],"id":"UUID"}],"id":"UUID"},{"href":"mermaid.html","name":"Item","id":"UUID"},{"name":"Latex usage","href":"latex.html","id":"UUID"},{"name":"Images","href":"images.html","id":"UUID"},{"name":"Autotitle","href":"autotitle.html","id":"UUID"},{"name":"includes","href":"includes.html","id":"UUID"},{"name":"Entry as include","href":"entry-as-include.html","id":"UUID"},{"name":"Includer of entry","href":"includer-of-entry.html","id":"UUID"},{"name":"generic","items":[{"name":"1","href":"generic/1.html","id":"UUID"},{"name":"2","href":"generic/2.html","id":"UUID"},{"name":"3","href":"generic/3.html","id":"UUID"},{"name":"Sub notes","items":[{"name":"1","href":"generic/Sub notes/1.html","id":"UUID"},{"name":"2","href":"generic/Sub notes/2.html","id":"UUID"}],"id":"UUID"}],"id":"UUID"},{"name":"openapi","items":[{"name":"Overview","href":"openapi/index.html","id":"UUID"},{"name":"test-controller","items":[{"name":"Overview","href":"openapi/test-controller/index.html","id":"UUID"},{"href":"openapi/test-controller/getWithPayloadResponse.html","name":"Simple get operation. тест новой верстки 3","id":"UUID"},{"href":"openapi/test-controller/getHiddenTest.html","name":"Test x-hidden attribute","id":"UUID"}],"id":"UUID"}],"id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`; diff --git a/tests/e2e/__snapshots__/translation.spec.ts.snap b/tests/e2e/__snapshots__/translation.spec.ts.snap index 82751bed1..3c594a8b1 100644 --- a/tests/e2e/__snapshots__/translation.spec.ts.snap +++ b/tests/e2e/__snapshots__/translation.spec.ts.snap @@ -1615,6 +1615,7 @@ href: index.yaml items: - name: '%%%4%%%' - href: index-direct.yaml + name: '%%%5%%%' navigation: header: leftItems: @@ -1657,6 +1658,9 @@ exports[`Translate command > extract yaml scheme files 6`] = ` Дочерняя страница + + Item + " diff --git a/tests/e2e/errors.spec.ts b/tests/e2e/errors.spec.ts index e1d635d36..4376340e1 100644 --- a/tests/e2e/errors.spec.ts +++ b/tests/e2e/errors.spec.ts @@ -39,12 +39,12 @@ describe('Errors', () => { test('mocks/errors/object-validation', ({html}: TestResult) => { expectErrors(html, [ - 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[1].name: found [object Object] value', - 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[2].href: found [object Object] value', - 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[3].items[0].name: found [object Object] value', - 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[4].title: found [object Object] value', - 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[5].label: found [object Object] value', - 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[6].navigation: found [object Object] value', + 'ERR Invalid toc structure in toc.yaml at items[1].name: found [object Object] value', + 'ERR Invalid toc structure in toc.yaml at items[2].href: found [object Object] value', + 'ERR Invalid toc structure in toc.yaml at items[3].items[0].name: found [object Object] value', + 'ERR Invalid toc structure in toc.yaml at items[4].title: found [object Object] value', + 'ERR Invalid toc structure in toc.yaml at items[5].label: found [object Object] value', + 'ERR Invalid toc structure in toc.yaml at items[6].navigation: found [object Object] value', ]); }); diff --git a/tests/mocks/errors/object-validation/input/toc.yaml b/tests/mocks/errors/object-validation/input/toc.yaml index 3367020e2..7c5c020c9 100644 --- a/tests/mocks/errors/object-validation/input/toc.yaml +++ b/tests/mocks/errors/object-validation/input/toc.yaml @@ -9,6 +9,9 @@ items: items: - name: {{some-var}} href: nested-invalid.md - - title: {{some-var}} - - label: {{some-var}} - - navigation: {{some-var}} \ No newline at end of file + - name: Title Item + title: {{some-var}} + - name: Label Item + label: {{some-var}} + - name: Navigation Item + navigation: {{some-var}} \ No newline at end of file diff --git a/tests/mocks/include-toc/test10/input/toc.yaml b/tests/mocks/include-toc/test10/input/toc.yaml index 79c2160aa..accd482ef 100644 --- a/tests/mocks/include-toc/test10/input/toc.yaml +++ b/tests/mocks/include-toc/test10/input/toc.yaml @@ -1,9 +1,10 @@ title: main items: - - include: - path: test - includers: - - name: generic - input: test - linkIndex: true - linkIndexAutotitle: true +- include: + path: test + includers: + - name: generic + input: test + linkIndex: true + linkIndexAutotitle: true + name: Included diff --git a/tests/mocks/include-toc/test2/input/folder/toc.yaml b/tests/mocks/include-toc/test2/input/folder/toc.yaml index d13919506..afbd0e8ac 100644 --- a/tests/mocks/include-toc/test2/input/folder/toc.yaml +++ b/tests/mocks/include-toc/test2/input/folder/toc.yaml @@ -1,6 +1,8 @@ items: - - name: NameA - href: fileA.md - - name: NameB - href: fileB.md - - include: {path: folder/folder/toc.yaml } +- name: NameA + href: fileA.md +- name: NameB + href: fileB.md +- include: + path: folder/folder/toc.yaml + name: Included diff --git a/tests/mocks/include-toc/test2/input/toc.yaml b/tests/mocks/include-toc/test2/input/toc.yaml index 8b9fd7545..9b78dacf5 100644 --- a/tests/mocks/include-toc/test2/input/toc.yaml +++ b/tests/mocks/include-toc/test2/input/toc.yaml @@ -1,6 +1,8 @@ items: - - name: Name1 - href: file1.md - - include: { path: folder/toc.yaml } - - name: NameX - href: fileX.md +- name: Name1 + href: file1.md +- include: + path: folder/toc.yaml + name: Included +- name: NameX + href: fileX.md diff --git a/tests/mocks/include-toc/test3/input/product1/core/toc_m.yaml b/tests/mocks/include-toc/test3/input/product1/core/toc_m.yaml index 45cce729a..b65ff28d8 100644 --- a/tests/mocks/include-toc/test3/input/product1/core/toc_m.yaml +++ b/tests/mocks/include-toc/test3/input/product1/core/toc_m.yaml @@ -1,2 +1,3 @@ items: -- include: { mode: merge, path: product/toc_p.yaml } \ No newline at end of file +- name: Merge Include + include: { mode: merge, path: product/toc_p.yaml } \ No newline at end of file diff --git a/tests/mocks/include-toc/test3/input/product1/toc.yaml b/tests/mocks/include-toc/test3/input/product1/toc.yaml index 93c630bdf..792062762 100644 --- a/tests/mocks/include-toc/test3/input/product1/toc.yaml +++ b/tests/mocks/include-toc/test3/input/product1/toc.yaml @@ -1,3 +1,6 @@ title: Product 1 title items: -- include: { mode: merge, path: core/toc_m.yaml } +- include: + mode: merge + path: core/toc_m.yaml + name: Included diff --git a/tests/mocks/include-toc/test3/input/product2/core/toc_m.yaml b/tests/mocks/include-toc/test3/input/product2/core/toc_m.yaml index 45cce729a..b65ff28d8 100644 --- a/tests/mocks/include-toc/test3/input/product2/core/toc_m.yaml +++ b/tests/mocks/include-toc/test3/input/product2/core/toc_m.yaml @@ -1,2 +1,3 @@ items: -- include: { mode: merge, path: product/toc_p.yaml } \ No newline at end of file +- name: Merge Include + include: { mode: merge, path: product/toc_p.yaml } \ No newline at end of file diff --git a/tests/mocks/include-toc/test3/input/product2/overlay1/toc.yaml b/tests/mocks/include-toc/test3/input/product2/overlay1/toc.yaml index 84d0b2404..25d9dd9bc 100644 --- a/tests/mocks/include-toc/test3/input/product2/overlay1/toc.yaml +++ b/tests/mocks/include-toc/test3/input/product2/overlay1/toc.yaml @@ -1,2 +1,5 @@ items: -- include: { mode: merge, path: ../core/toc_m.yaml } \ No newline at end of file +- include: + mode: merge + path: ../core/toc_m.yaml + name: Included diff --git a/tests/mocks/include-toc/test3/input/product2/overlay2/toc.yaml b/tests/mocks/include-toc/test3/input/product2/overlay2/toc.yaml index 84d0b2404..25d9dd9bc 100644 --- a/tests/mocks/include-toc/test3/input/product2/overlay2/toc.yaml +++ b/tests/mocks/include-toc/test3/input/product2/overlay2/toc.yaml @@ -1,2 +1,5 @@ items: -- include: { mode: merge, path: ../core/toc_m.yaml } \ No newline at end of file +- include: + mode: merge + path: ../core/toc_m.yaml + name: Included diff --git a/tests/mocks/include-toc/test3/input/product2/overlay3/toc.yaml b/tests/mocks/include-toc/test3/input/product2/overlay3/toc.yaml index 84d0b2404..25d9dd9bc 100644 --- a/tests/mocks/include-toc/test3/input/product2/overlay3/toc.yaml +++ b/tests/mocks/include-toc/test3/input/product2/overlay3/toc.yaml @@ -1,2 +1,5 @@ items: -- include: { mode: merge, path: ../core/toc_m.yaml } \ No newline at end of file +- include: + mode: merge + path: ../core/toc_m.yaml + name: Included diff --git a/tests/mocks/include-toc/test5/input/core/concepts/toc_p.yaml b/tests/mocks/include-toc/test5/input/core/concepts/toc_p.yaml index 4f411030f..94d3d1541 100644 --- a/tests/mocks/include-toc/test5/input/core/concepts/toc_p.yaml +++ b/tests/mocks/include-toc/test5/input/core/concepts/toc_p.yaml @@ -1,3 +1,4 @@ items: - - include: { mode: link, path: toc_i.yaml } + - name: Include Item + include: { mode: link, path: toc_i.yaml } - name: core/concepts/toc_p/item diff --git a/tests/mocks/include-toc/test5/input/core/toc_m.yaml b/tests/mocks/include-toc/test5/input/core/toc_m.yaml index 38776f89d..5fa5f60f3 100644 --- a/tests/mocks/include-toc/test5/input/core/toc_m.yaml +++ b/tests/mocks/include-toc/test5/input/core/toc_m.yaml @@ -1,3 +1,4 @@ items: - name: core/toc_m/item - - include: { mode: merge, path: overlay/toc_p.yaml } + - name: Merge Include + include: { mode: merge, path: overlay/toc_p.yaml } diff --git a/tests/mocks/include-toc/test5/input/core/toc_p.yaml b/tests/mocks/include-toc/test5/input/core/toc_p.yaml index 5900ecdf4..233b27cfb 100644 --- a/tests/mocks/include-toc/test5/input/core/toc_p.yaml +++ b/tests/mocks/include-toc/test5/input/core/toc_p.yaml @@ -1,5 +1,6 @@ items: - name: core/toc_p/item - - include: + - name: Include Item + include: mode: link path: toc_i.yaml diff --git a/tests/mocks/include-toc/test5/input/overlay/toc_p.yaml b/tests/mocks/include-toc/test5/input/overlay/toc_p.yaml index fa7274c9d..11d351a88 100644 --- a/tests/mocks/include-toc/test5/input/overlay/toc_p.yaml +++ b/tests/mocks/include-toc/test5/input/overlay/toc_p.yaml @@ -1,3 +1,4 @@ items: - name: overlay/toc_p/item - - include: { mode: link, path: toc_i.yaml } + - name: Include Item + include: { mode: link, path: toc_i.yaml } diff --git a/tests/mocks/include-toc/test5/input/toc.yaml b/tests/mocks/include-toc/test5/input/toc.yaml index f190f116a..e7369e3c9 100644 --- a/tests/mocks/include-toc/test5/input/toc.yaml +++ b/tests/mocks/include-toc/test5/input/toc.yaml @@ -1,4 +1,7 @@ title: main items: - - name: toc_i/item - - include: { mode: merge, path: core/toc_m.yaml } +- name: toc_i/item +- include: + mode: merge + path: core/toc_m.yaml + name: Included diff --git a/tests/mocks/include-toc/test6/input/toc.yaml b/tests/mocks/include-toc/test6/input/toc.yaml index f60bab4a0..3329f1902 100644 --- a/tests/mocks/include-toc/test6/input/toc.yaml +++ b/tests/mocks/include-toc/test6/input/toc.yaml @@ -1,8 +1,9 @@ title: main items: - - include: - path: test - includers: - - name: generic - autotitle: false - input: test +- include: + path: test + includers: + - name: generic + autotitle: false + input: test + name: Included diff --git a/tests/mocks/include-toc/test7/input/ru/toc.yaml b/tests/mocks/include-toc/test7/input/ru/toc.yaml index 334535f11..a0e8f049c 100644 --- a/tests/mocks/include-toc/test7/input/ru/toc.yaml +++ b/tests/mocks/include-toc/test7/input/ru/toc.yaml @@ -1,3 +1,6 @@ title: Toc items: - - include: { mode: root_merge, path: ru/sub/folder/toc.yaml } +- include: + mode: root_merge + path: ru/sub/folder/toc.yaml + name: Included diff --git a/tests/mocks/include-toc/test8/input/toc.yaml b/tests/mocks/include-toc/test8/input/toc.yaml index 393aeb218..22fa5b123 100644 --- a/tests/mocks/include-toc/test8/input/toc.yaml +++ b/tests/mocks/include-toc/test8/input/toc.yaml @@ -1,9 +1,10 @@ title: main items: - - include: - path: test - includers: - - name: generic - autotitle: false - input: test - linkIndex: true +- include: + path: test + includers: + - name: generic + autotitle: false + input: test + linkIndex: true + name: Included diff --git a/tests/mocks/include-toc/test9/input/toc.yaml b/tests/mocks/include-toc/test9/input/toc.yaml index f60bab4a0..3329f1902 100644 --- a/tests/mocks/include-toc/test9/input/toc.yaml +++ b/tests/mocks/include-toc/test9/input/toc.yaml @@ -1,8 +1,9 @@ title: main items: - - include: - path: test - includers: - - name: generic - autotitle: false - input: test +- include: + path: test + includers: + - name: generic + autotitle: false + input: test + name: Included diff --git a/tests/mocks/preprocess/input/toc.yaml b/tests/mocks/preprocess/input/toc.yaml index 9c31eac08..0b32a18c5 100644 --- a/tests/mocks/preprocess/input/toc.yaml +++ b/tests/mocks/preprocess/input/toc.yaml @@ -1,24 +1,30 @@ items: - - name: Md item with not_var syntax - href: ./1.md - - name: Md item named without extension - href: ./1 - - include: {path: toc-i.yaml} - - include: {path: sub/toc.yaml, mode: link} - - href: ./mermaid - - name: '{#T}' - href: ./latex - - name: Images - href: ./images - - name: Autotitle - href: ./autotitle - - name: includes - href: ./includes - - name: level11 - href: ./includes/level11 - - name: level0 - href: ./level0 - - name: level1 - href: ./level1/level1 - - name: level2 - href: ./level1/level2/level2 +- name: Md item with not_var syntax + href: ./1.md +- name: Md item named without extension + href: ./1 +- include: + path: toc-i.yaml + name: Included +- include: + path: sub/toc.yaml + mode: link + name: Included +- href: ./mermaid + name: Item +- name: '{#T}' + href: ./latex +- name: Images + href: ./images +- name: Autotitle + href: ./autotitle +- name: includes + href: ./includes +- name: level11 + href: ./includes/level11 +- name: level0 + href: ./level0 +- name: level1 + href: ./level1/level1 +- name: level2 + href: ./level1/level2/level2 diff --git a/tests/mocks/regression/input/merge/toc.yaml b/tests/mocks/regression/input/merge/toc.yaml index 9fef257c7..124fc8edd 100644 --- a/tests/mocks/regression/input/merge/toc.yaml +++ b/tests/mocks/regression/input/merge/toc.yaml @@ -1,6 +1,9 @@ items: - - name: Use merged - href: ./merge.md - - name: Multitoc item - href: ../1.md - - include: {path: ../merge-source/toc-m.yaml, mode: merge} +- name: Use merged + href: ./merge.md +- name: Multitoc item + href: ../1.md +- include: + path: ../merge-source/toc-m.yaml + mode: merge + name: Included diff --git a/tests/mocks/regression/input/toc.yaml b/tests/mocks/regression/input/toc.yaml index 3f07ed907..2b7d2e051 100644 --- a/tests/mocks/regression/input/toc.yaml +++ b/tests/mocks/regression/input/toc.yaml @@ -1,43 +1,47 @@ items: - - name: Verbose root (index.yaml) will be transformed to index.html - href: index.yaml - - name: Root will be transformed to index.html - href: / - - name: Md item with not_var syntax - href: ./1.md - - name: Md item named without extension - href: ./1 - - name: Item with empty href - href: - - name: Multitoc item - href: ./merge/merged.md - - name: Fragments - href: ./includes/fragments.md - - include: {path: toc-i.yaml} - - include: {path: sub/toc.yaml, mode: link} - - href: ./mermaid - - name: '{#T}' - href: ./latex - - name: Images - href: ./images - - name: Autotitle - href: ./autotitle - - name: includes - href: ./includes - # Test for race condition: entry-as-include.md is both an entry and included by includer-of-entry.md - - name: Entry as include - href: ./entry-as-include.md - - name: Includer of entry - href: ./includer-of-entry.md - - name: generic - include: - path: generic - includers: - - name: generic - - name: openapi - include: - path: openapi - includers: - - name: openapi - input: openapi-spec.yaml - +- name: Verbose root (index.yaml) will be transformed to index.html + href: index.yaml +- name: Root will be transformed to index.html + href: / +- name: Md item with not_var syntax + href: ./1.md +- name: Md item named without extension + href: ./1 +- name: Item with empty href + href: null +- name: Multitoc item + href: ./merge/merged.md +- name: Fragments + href: ./includes/fragments.md +- include: + path: toc-i.yaml + name: Included +- include: + path: sub/toc.yaml + mode: link + name: Included +- href: ./mermaid + name: Item +- name: '{#T}' + href: ./latex +- name: Images + href: ./images +- name: Autotitle + href: ./autotitle +- name: includes + href: ./includes +- name: Entry as include + href: ./entry-as-include.md +- name: Includer of entry + href: ./includer-of-entry.md +- name: generic + include: + path: generic + includers: + - name: generic +- name: openapi + include: + path: openapi + includers: + - name: openapi + input: openapi-spec.yaml diff --git a/tests/mocks/translation/dir-files/input/ru/nested/toc.yaml b/tests/mocks/translation/dir-files/input/ru/nested/toc.yaml index 9c83215a0..2140c051a 100644 --- a/tests/mocks/translation/dir-files/input/ru/nested/toc.yaml +++ b/tests/mocks/translation/dir-files/input/ru/nested/toc.yaml @@ -1,19 +1,22 @@ title: Diplodoc href: index.yaml items: - - name: API Yandex Cloud - href: index.yaml - - include: {mode: merge, path: folder1/toc-i.yaml} - - name: Yandex Flavored Markdown - href: +- name: API Yandex Cloud + href: index.yaml +- include: + mode: merge + path: folder1/toc-i.yaml + name: Included +- name: Yandex Flavored Markdown + href: null + items: + - name: Синтаксис items: - - name: Синтаксис - items: - - name: Обзор - href: syntax/index.md - - name: Базовая разметка - href: syntax/base.md - - name: Списки - href: syntax/lists.md - - name: Was filtered above - href: use_filtered_above.md \ No newline at end of file + - name: Обзор + href: syntax/index.md + - name: Базовая разметка + href: syntax/base.md + - name: Списки + href: syntax/lists.md +- name: Was filtered above + href: use_filtered_above.md diff --git a/tests/mocks/translation/yaml-scheme/input/ru/toc.yaml b/tests/mocks/translation/yaml-scheme/input/ru/toc.yaml index e18bffd2e..8236cb447 100644 --- a/tests/mocks/translation/yaml-scheme/input/ru/toc.yaml +++ b/tests/mocks/translation/yaml-scheme/input/ru/toc.yaml @@ -1,19 +1,20 @@ title: Заголовок href: index.yaml items: - - name: Дочерняя страница - - href: index-direct.yaml +- name: Дочерняя страница +- href: index-direct.yaml + name: Item navigation: header: leftItems: - - text: 'Инструменты' - type: 'dropdown' - items: - - text: 'Пункт меню' - type: 'link' - href: 'menu/item' + - text: Инструменты + type: dropdown + items: + - text: Пункт меню + type: link + href: menu/item logo: light: - icon: 'https://icon.link/logo.svg' - url: 'https://site.ru' - urlTitle : 'На сайт сервиса' + icon: https://icon.link/logo.svg + url: https://site.ru + urlTitle: На сайт сервиса diff --git a/tests/package-lock.json b/tests/package-lock.json index aeb120d11..9c38fcf64 100644 --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -32,15 +32,17 @@ }, "..": { "name": "@diplodoc/cli", - "version": "5.29.0", + "version": "5.42.0", "dev": true, "license": "MIT", "dependencies": { - "@diplodoc/client": "^5.2.11", - "@diplodoc/liquid": "^1.4.0", - "@diplodoc/transform": "^4.72.0", - "@diplodoc/translation": "^1.7.19", + "@diplodoc/client": "^5.7.7", + "@diplodoc/liquid": "^1.5.2", + "@diplodoc/transform": "^4.75.4", + "@diplodoc/translation": "^1.7.24", + "@diplodoc/utils": "^2.2.3", "@gravity-ui/uikit-themer": "^1.7.0", + "@inquirer/prompts": "^8.3.2", "chalk": "^4.1.2", "chroma-js": "^3.2.0", "commander": "^12.0.0", @@ -69,14 +71,14 @@ "devDependencies": { "@aws-sdk/client-s3": "^3.758.0", "@aws-sdk/lib-storage": "^3.758.0", + "@diplodoc/infra": "2.0.3", "@diplodoc/latex-extension": "^1.4.1", - "@diplodoc/lint": "^1.14.2", "@diplodoc/mermaid-extension": "^1.3.5", "@diplodoc/openapi-extension": "^5.1.3", - "@diplodoc/page-constructor-extension": "^0.13.2", - "@diplodoc/search-extension": "^3.0.2", + "@diplodoc/page-constructor-extension": "^0.13.4", + "@diplodoc/search-extension": "^3.0.5", "@diplodoc/tsconfig": "^1.0.2", - "@diplodoc/yfmlint": "^1.6.0", + "@diplodoc/yfmlint": "^1.7.5", "@octokit/core": "4.2.4", "@types/async": "3.2.15", "@types/chalk": "2.2.0", @@ -86,6 +88,7 @@ "@types/json-stringify-safe": "5.0.3", "@types/lodash": "4.14.195", "@types/markdown-it": "^13.0.9", + "@types/markdown-it-attrs": "^4.1.0", "@types/mime-types": "2.1.4", "@types/node": "^22.19.0", "@vitest/coverage-v8": "^3.2.1", @@ -114,7 +117,7 @@ "walk-sync": "3.0.0" }, "engines": { - "node": ">=22.*", + "node": ">=24", "npm": ">=11.5.1" } },