🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
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.
|
||||
74
node_modules/github-slugger/README.md
generated
vendored
Normal file
74
node_modules/github-slugger/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# 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
|
||||
var GithubSlugger = require('github-slugger')
|
||||
var 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` 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
|
||||
var slug = require('github-slugger').slug;
|
||||
|
||||
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)
|
||||
50
node_modules/github-slugger/index.js
generated
vendored
Normal file
50
node_modules/github-slugger/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
const regex = require('./regex.js')
|
||||
|
||||
module.exports = BananaSlug
|
||||
|
||||
const own = Object.hasOwnProperty
|
||||
|
||||
function BananaSlug () {
|
||||
const self = this
|
||||
|
||||
if (!(self instanceof BananaSlug)) return new BananaSlug()
|
||||
|
||||
self.reset()
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a unique slug.
|
||||
* @param {string} value String of text to slugify
|
||||
* @param {boolean} [false] Keep the current case, otherwise make all lowercase
|
||||
* @return {string} A unique slug string
|
||||
*/
|
||||
BananaSlug.prototype.slug = function (value, maintainCase) {
|
||||
const self = this
|
||||
let slug = slugger(value, maintainCase === true)
|
||||
const originalSlug = slug
|
||||
|
||||
while (own.call(self.occurrences, slug)) {
|
||||
self.occurrences[originalSlug]++
|
||||
slug = originalSlug + '-' + self.occurrences[originalSlug]
|
||||
}
|
||||
|
||||
self.occurrences[slug] = 0
|
||||
|
||||
return slug
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset - Forget all previous slugs
|
||||
* @return void
|
||||
*/
|
||||
BananaSlug.prototype.reset = function () {
|
||||
this.occurrences = Object.create(null)
|
||||
}
|
||||
|
||||
function slugger (string, maintainCase) {
|
||||
if (typeof string !== 'string') return ''
|
||||
if (!maintainCase) string = string.toLowerCase()
|
||||
return string.replace(regex, '').replace(/ /g, '-')
|
||||
}
|
||||
|
||||
BananaSlug.slug = slugger
|
||||
61
node_modules/github-slugger/package.json
generated
vendored
Normal file
61
node_modules/github-slugger/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"name": "github-slugger",
|
||||
"description": "Generate a slug just like GitHub does for markdown headings.",
|
||||
"version": "1.5.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"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"regex.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@octokit/rest": "^19.0.0",
|
||||
"@unicode/unicode-13.0.0": "^1.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",
|
||||
"nyc": "^15.0.0",
|
||||
"regenerate": "^1.0.0",
|
||||
"rehype-parse": "^8.0.0",
|
||||
"standard": "*",
|
||||
"tap-spec": "^5.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"unified": "^10.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/Flet/github-slugger",
|
||||
"keywords": [
|
||||
"anchor",
|
||||
"github",
|
||||
"hash",
|
||||
"heading",
|
||||
"markdown",
|
||||
"slug",
|
||||
"slugger",
|
||||
"url"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Flet/github-slugger.git"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "standard --fix",
|
||||
"test-api": "tape test | tap-spec",
|
||||
"test-coverage": "nyc --reporter lcov tape test/index.js | tap-spec",
|
||||
"test": "npm run format && npm run test-coverage"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
}
|
||||
}
|
||||
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
Loading…
Add table
Add a link
Reference in a new issue