mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-22 05:27:00 +02:00
feat(content-docs): sidebar category linking to document or auto-generated index page (#5830)
Co-authored-by: Joshua Chen <sidachen2003@gmail.com> Co-authored-by: Armano <armano2@users.noreply.github.com> Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
This commit is contained in:
parent
95f911efef
commit
cfae5d0933
105 changed files with 3904 additions and 816 deletions
24
packages/docusaurus-utils/src/slugger.ts
Normal file
24
packages/docusaurus-utils/src/slugger.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import GithubSlugger from 'github-slugger';
|
||||
|
||||
// We create our own abstraction on top of the lib:
|
||||
// - unify usage everywhere in the codebase
|
||||
// - ability to add extra options
|
||||
export type SluggerOptions = {maintainCase?: boolean};
|
||||
|
||||
export type Slugger = {
|
||||
slug: (value: string, options?: SluggerOptions) => string;
|
||||
};
|
||||
|
||||
export function createSlugger(): Slugger {
|
||||
const githubSlugger = new GithubSlugger();
|
||||
return {
|
||||
slug: (value, options) => githubSlugger.slug(value, options?.maintainCase),
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue