Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.
This commit is contained in:
5
node_modules/github-slugger/LICENSE
generated
vendored
Normal file
5
node_modules/github-slugger/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Copyright (c) 2015, Dan Flettre <fletd01@yahoo.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
75
node_modules/github-slugger/README.md
generated
vendored
Normal file
75
node_modules/github-slugger/README.md
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
# github-slugger
|
||||
|
||||
[![npm][npm-image]][npm-url]
|
||||
[![Build][build-badge]][build]
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/github-slugger.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/github-slugger
|
||||
[build-badge]: https://github.com/Flet/github-slugger/workflows/main/badge.svg
|
||||
[build]: https://github.com/Flet/github-slugger/actions
|
||||
|
||||
Generate a slug just like GitHub does for markdown headings. It also ensures slugs are unique in the same way GitHub does it. The overall goal of this package is to emulate the way GitHub handles generating markdown heading anchors as close as possible.
|
||||
|
||||
This project is not a markdown or HTML parser: passing `alpha *bravo* charlie`
|
||||
or `alpha <em>bravo</em> charlie` doesn’t work.
|
||||
Instead pass the plain text value of the heading: `alpha bravo charlie`.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install github-slugger
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import GithubSlugger from 'github-slugger'
|
||||
|
||||
const slugger = new GithubSlugger()
|
||||
|
||||
slugger.slug('foo')
|
||||
// returns 'foo'
|
||||
|
||||
slugger.slug('foo')
|
||||
// returns 'foo-1'
|
||||
|
||||
slugger.slug('bar')
|
||||
// returns 'bar'
|
||||
|
||||
slugger.slug('foo')
|
||||
// returns 'foo-2'
|
||||
|
||||
slugger.slug('Привет non-latin 你好')
|
||||
// returns 'привет-non-latin-你好'
|
||||
|
||||
slugger.slug('😄 emoji')
|
||||
// returns '-emoji'
|
||||
|
||||
slugger.reset()
|
||||
|
||||
slugger.slug('foo')
|
||||
// returns 'foo'
|
||||
```
|
||||
|
||||
Check [`test/fixtures.json`](test/fixtures.json) for more examples.
|
||||
|
||||
If you need, you can also use the underlying implementation which does not keep
|
||||
track of the previously slugged strings (not recommended):
|
||||
|
||||
```js
|
||||
import GithubSlugger, {slug} from 'github-slugger'
|
||||
|
||||
slug('foo bar baz')
|
||||
// returns 'foo-bar-baz'
|
||||
|
||||
slug('foo bar baz')
|
||||
// returns the same slug 'foo-bar-baz' because it does not keep track
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.
|
||||
|
||||
## License
|
||||
|
||||
[ISC](LICENSE)
|
43
node_modules/github-slugger/index.d.ts
generated
vendored
Normal file
43
node_modules/github-slugger/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Generate a slug.
|
||||
*
|
||||
* Does not track previously generated slugs: repeated calls with the same value
|
||||
* will result in the exact same slug.
|
||||
* Use the `GithubSlugger` class to get unique slugs.
|
||||
*
|
||||
* @param {string} value
|
||||
* String of text to slugify
|
||||
* @param {boolean} [maintainCase=false]
|
||||
* Keep the current case, otherwise make all lowercase
|
||||
* @return {string}
|
||||
* A unique slug string
|
||||
*/
|
||||
export function slug(value: string, maintainCase?: boolean | undefined): string;
|
||||
/**
|
||||
* Slugger.
|
||||
*/
|
||||
export default class BananaSlug {
|
||||
/** @type {Record<string, number>} */
|
||||
occurrences: Record<string, number>;
|
||||
/**
|
||||
* Generate a unique slug.
|
||||
*
|
||||
* Tracks previously generated slugs: repeated calls with the same value
|
||||
* will result in different slugs.
|
||||
* Use the `slug` function to get same slugs.
|
||||
*
|
||||
* @param {string} value
|
||||
* String of text to slugify
|
||||
* @param {boolean} [maintainCase=false]
|
||||
* Keep the current case, otherwise make all lowercase
|
||||
* @return {string}
|
||||
* A unique slug string
|
||||
*/
|
||||
slug(value: string, maintainCase?: boolean | undefined): string;
|
||||
/**
|
||||
* Reset - Forget all previous slugs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
reset(): void;
|
||||
}
|
77
node_modules/github-slugger/index.js
generated
vendored
Normal file
77
node_modules/github-slugger/index.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
import { regex } from './regex.js'
|
||||
|
||||
const own = Object.hasOwnProperty
|
||||
|
||||
/**
|
||||
* Slugger.
|
||||
*/
|
||||
export default class BananaSlug {
|
||||
/**
|
||||
* Create a new slug class.
|
||||
*/
|
||||
constructor () {
|
||||
/** @type {Record<string, number>} */
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
this.occurrences
|
||||
|
||||
this.reset()
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a unique slug.
|
||||
*
|
||||
* Tracks previously generated slugs: repeated calls with the same value
|
||||
* will result in different slugs.
|
||||
* Use the `slug` function to get same slugs.
|
||||
*
|
||||
* @param {string} value
|
||||
* String of text to slugify
|
||||
* @param {boolean} [maintainCase=false]
|
||||
* Keep the current case, otherwise make all lowercase
|
||||
* @return {string}
|
||||
* A unique slug string
|
||||
*/
|
||||
slug (value, maintainCase) {
|
||||
const self = this
|
||||
let result = slug(value, maintainCase === true)
|
||||
const originalSlug = result
|
||||
|
||||
while (own.call(self.occurrences, result)) {
|
||||
self.occurrences[originalSlug]++
|
||||
result = originalSlug + '-' + self.occurrences[originalSlug]
|
||||
}
|
||||
|
||||
self.occurrences[result] = 0
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset - Forget all previous slugs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
reset () {
|
||||
this.occurrences = Object.create(null)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a slug.
|
||||
*
|
||||
* Does not track previously generated slugs: repeated calls with the same value
|
||||
* will result in the exact same slug.
|
||||
* Use the `GithubSlugger` class to get unique slugs.
|
||||
*
|
||||
* @param {string} value
|
||||
* String of text to slugify
|
||||
* @param {boolean} [maintainCase=false]
|
||||
* Keep the current case, otherwise make all lowercase
|
||||
* @return {string}
|
||||
* A unique slug string
|
||||
*/
|
||||
export function slug (value, maintainCase) {
|
||||
if (typeof value !== 'string') return ''
|
||||
if (!maintainCase) value = value.toLowerCase()
|
||||
return value.replace(regex, '').replace(/ /g, '-')
|
||||
}
|
71
node_modules/github-slugger/package.json
generated
vendored
Normal file
71
node_modules/github-slugger/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "github-slugger",
|
||||
"description": "Generate a slug just like GitHub does for markdown headings.",
|
||||
"version": "2.0.0",
|
||||
"author": "Dan Flettre <flettre@gmail.com>",
|
||||
"contributors": [
|
||||
"Dan Flettre <flettre@gmail.com>",
|
||||
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Flet/github-slugger/issues"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index.js",
|
||||
"regex.d.ts",
|
||||
"regex.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@octokit/rest": "^19.0.0",
|
||||
"@types/regenerate": "^1.0.0",
|
||||
"@types/tape": "^4.0.0",
|
||||
"@unicode/unicode-13.0.0": "^1.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"hast-util-select": "^5.0.0",
|
||||
"mdast-util-gfm": "^2.0.0",
|
||||
"mdast-util-to-markdown": "^1.0.0",
|
||||
"node-fetch": "^3.0.0",
|
||||
"regenerate": "^1.0.0",
|
||||
"rehype-parse": "^8.0.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"standard": "*",
|
||||
"tap-spec": "^5.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"type-coverage": "^2.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"unified": "^10.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/Flet/github-slugger",
|
||||
"keywords": [
|
||||
"anchor",
|
||||
"github",
|
||||
"hash",
|
||||
"heading",
|
||||
"markdown",
|
||||
"slug",
|
||||
"slugger",
|
||||
"url"
|
||||
],
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Flet/github-slugger.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npm run build && npm run format",
|
||||
"build": "rimraf \"{script,test}/**/*.d.ts\" \"*.d.ts\" && tsc && type-coverage",
|
||||
"format": "standard --fix",
|
||||
"test-api": "tape test | tap-spec",
|
||||
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
|
||||
"test": "npm run build && npm run format && npm run test-coverage"
|
||||
},
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"strict": true
|
||||
}
|
||||
}
|
1
node_modules/github-slugger/regex.d.ts
generated
vendored
Normal file
1
node_modules/github-slugger/regex.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const regex: RegExp;
|
3
node_modules/github-slugger/regex.js
generated
vendored
Normal file
3
node_modules/github-slugger/regex.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user