🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
43
node_modules/micromark-factory-title/dev/index.d.ts
generated
vendored
Normal file
43
node_modules/micromark-factory-title/dev/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Parse titles.
|
||||
*
|
||||
* ###### Examples
|
||||
*
|
||||
* ```markdown
|
||||
* "a"
|
||||
* 'b'
|
||||
* (c)
|
||||
* "a
|
||||
* b"
|
||||
* 'a
|
||||
* b'
|
||||
* (a\)b)
|
||||
* ```
|
||||
*
|
||||
* @param {Effects} effects
|
||||
* Context.
|
||||
* @param {State} ok
|
||||
* State switched to when successful.
|
||||
* @param {State} nok
|
||||
* State switched to when unsuccessful.
|
||||
* @param {TokenType} type
|
||||
* Type of the whole title (`"a"`, `'b'`, `(c)`).
|
||||
* @param {TokenType} markerType
|
||||
* Type for the markers (`"`, `'`, `(`, and `)`).
|
||||
* @param {TokenType} stringType
|
||||
* Type for the value (`a`).
|
||||
* @returns {State}
|
||||
* Start state.
|
||||
*/
|
||||
export function factoryTitle(
|
||||
effects: Effects,
|
||||
ok: State,
|
||||
nok: State,
|
||||
type: TokenType,
|
||||
markerType: TokenType,
|
||||
stringType: TokenType
|
||||
): State
|
||||
export type Code = import('micromark-util-types').Code
|
||||
export type Effects = import('micromark-util-types').Effects
|
||||
export type State = import('micromark-util-types').State
|
||||
export type TokenType = import('micromark-util-types').TokenType
|
||||
170
node_modules/micromark-factory-title/dev/index.js
generated
vendored
Normal file
170
node_modules/micromark-factory-title/dev/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
/**
|
||||
* @typedef {import('micromark-util-types').Code} Code
|
||||
* @typedef {import('micromark-util-types').Effects} Effects
|
||||
* @typedef {import('micromark-util-types').State} State
|
||||
* @typedef {import('micromark-util-types').TokenType} TokenType
|
||||
*/
|
||||
|
||||
import {factorySpace} from 'micromark-factory-space'
|
||||
import {markdownLineEnding} from 'micromark-util-character'
|
||||
import {codes} from 'micromark-util-symbol/codes.js'
|
||||
import {constants} from 'micromark-util-symbol/constants.js'
|
||||
import {types} from 'micromark-util-symbol/types.js'
|
||||
|
||||
/**
|
||||
* Parse titles.
|
||||
*
|
||||
* ###### Examples
|
||||
*
|
||||
* ```markdown
|
||||
* "a"
|
||||
* 'b'
|
||||
* (c)
|
||||
* "a
|
||||
* b"
|
||||
* 'a
|
||||
* b'
|
||||
* (a\)b)
|
||||
* ```
|
||||
*
|
||||
* @param {Effects} effects
|
||||
* Context.
|
||||
* @param {State} ok
|
||||
* State switched to when successful.
|
||||
* @param {State} nok
|
||||
* State switched to when unsuccessful.
|
||||
* @param {TokenType} type
|
||||
* Type of the whole title (`"a"`, `'b'`, `(c)`).
|
||||
* @param {TokenType} markerType
|
||||
* Type for the markers (`"`, `'`, `(`, and `)`).
|
||||
* @param {TokenType} stringType
|
||||
* Type for the value (`a`).
|
||||
* @returns {State}
|
||||
* Start state.
|
||||
*/
|
||||
// eslint-disable-next-line max-params
|
||||
export function factoryTitle(effects, ok, nok, type, markerType, stringType) {
|
||||
/** @type {NonNullable<Code>} */
|
||||
let marker
|
||||
|
||||
return start
|
||||
|
||||
/**
|
||||
* Start of title.
|
||||
*
|
||||
* ```markdown
|
||||
* > | "a"
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function start(code) {
|
||||
if (
|
||||
code === codes.quotationMark ||
|
||||
code === codes.apostrophe ||
|
||||
code === codes.leftParenthesis
|
||||
) {
|
||||
effects.enter(type)
|
||||
effects.enter(markerType)
|
||||
effects.consume(code)
|
||||
effects.exit(markerType)
|
||||
marker = code === codes.leftParenthesis ? codes.rightParenthesis : code
|
||||
return begin
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* After opening marker.
|
||||
*
|
||||
* This is also used at the closing marker.
|
||||
*
|
||||
* ```markdown
|
||||
* > | "a"
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function begin(code) {
|
||||
if (code === marker) {
|
||||
effects.enter(markerType)
|
||||
effects.consume(code)
|
||||
effects.exit(markerType)
|
||||
effects.exit(type)
|
||||
return ok
|
||||
}
|
||||
|
||||
effects.enter(stringType)
|
||||
return atBreak(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* At something, before something else.
|
||||
*
|
||||
* ```markdown
|
||||
* > | "a"
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function atBreak(code) {
|
||||
if (code === marker) {
|
||||
effects.exit(stringType)
|
||||
return begin(marker)
|
||||
}
|
||||
|
||||
if (code === codes.eof) {
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
// Note: blank lines can’t exist in content.
|
||||
if (markdownLineEnding(code)) {
|
||||
// To do: use `space_or_tab_eol_with_options`, connect.
|
||||
effects.enter(types.lineEnding)
|
||||
effects.consume(code)
|
||||
effects.exit(types.lineEnding)
|
||||
return factorySpace(effects, atBreak, types.linePrefix)
|
||||
}
|
||||
|
||||
effects.enter(types.chunkString, {contentType: constants.contentTypeString})
|
||||
return inside(code)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function inside(code) {
|
||||
if (code === marker || code === codes.eof || markdownLineEnding(code)) {
|
||||
effects.exit(types.chunkString)
|
||||
return atBreak(code)
|
||||
}
|
||||
|
||||
effects.consume(code)
|
||||
return code === codes.backslash ? escape : inside
|
||||
}
|
||||
|
||||
/**
|
||||
* After `\`, at a special character.
|
||||
*
|
||||
* ```markdown
|
||||
* > | "a\*b"
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function escape(code) {
|
||||
if (code === marker || code === codes.backslash) {
|
||||
effects.consume(code)
|
||||
return inside
|
||||
}
|
||||
|
||||
return inside(code)
|
||||
}
|
||||
}
|
||||
43
node_modules/micromark-factory-title/index.d.ts
generated
vendored
Normal file
43
node_modules/micromark-factory-title/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Parse titles.
|
||||
*
|
||||
* ###### Examples
|
||||
*
|
||||
* ```markdown
|
||||
* "a"
|
||||
* 'b'
|
||||
* (c)
|
||||
* "a
|
||||
* b"
|
||||
* 'a
|
||||
* b'
|
||||
* (a\)b)
|
||||
* ```
|
||||
*
|
||||
* @param {Effects} effects
|
||||
* Context.
|
||||
* @param {State} ok
|
||||
* State switched to when successful.
|
||||
* @param {State} nok
|
||||
* State switched to when unsuccessful.
|
||||
* @param {TokenType} type
|
||||
* Type of the whole title (`"a"`, `'b'`, `(c)`).
|
||||
* @param {TokenType} markerType
|
||||
* Type for the markers (`"`, `'`, `(`, and `)`).
|
||||
* @param {TokenType} stringType
|
||||
* Type for the value (`a`).
|
||||
* @returns {State}
|
||||
* Start state.
|
||||
*/
|
||||
export function factoryTitle(
|
||||
effects: Effects,
|
||||
ok: State,
|
||||
nok: State,
|
||||
type: TokenType,
|
||||
markerType: TokenType,
|
||||
stringType: TokenType
|
||||
): State
|
||||
export type Code = import('micromark-util-types').Code
|
||||
export type Effects = import('micromark-util-types').Effects
|
||||
export type State = import('micromark-util-types').State
|
||||
export type TokenType = import('micromark-util-types').TokenType
|
||||
156
node_modules/micromark-factory-title/index.js
generated
vendored
Normal file
156
node_modules/micromark-factory-title/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
/**
|
||||
* @typedef {import('micromark-util-types').Code} Code
|
||||
* @typedef {import('micromark-util-types').Effects} Effects
|
||||
* @typedef {import('micromark-util-types').State} State
|
||||
* @typedef {import('micromark-util-types').TokenType} TokenType
|
||||
*/
|
||||
|
||||
import {factorySpace} from 'micromark-factory-space'
|
||||
import {markdownLineEnding} from 'micromark-util-character'
|
||||
/**
|
||||
* Parse titles.
|
||||
*
|
||||
* ###### Examples
|
||||
*
|
||||
* ```markdown
|
||||
* "a"
|
||||
* 'b'
|
||||
* (c)
|
||||
* "a
|
||||
* b"
|
||||
* 'a
|
||||
* b'
|
||||
* (a\)b)
|
||||
* ```
|
||||
*
|
||||
* @param {Effects} effects
|
||||
* Context.
|
||||
* @param {State} ok
|
||||
* State switched to when successful.
|
||||
* @param {State} nok
|
||||
* State switched to when unsuccessful.
|
||||
* @param {TokenType} type
|
||||
* Type of the whole title (`"a"`, `'b'`, `(c)`).
|
||||
* @param {TokenType} markerType
|
||||
* Type for the markers (`"`, `'`, `(`, and `)`).
|
||||
* @param {TokenType} stringType
|
||||
* Type for the value (`a`).
|
||||
* @returns {State}
|
||||
* Start state.
|
||||
*/ // eslint-disable-next-line max-params
|
||||
export function factoryTitle(effects, ok, nok, type, markerType, stringType) {
|
||||
/** @type {NonNullable<Code>} */
|
||||
let marker
|
||||
return start
|
||||
|
||||
/**
|
||||
* Start of title.
|
||||
*
|
||||
* ```markdown
|
||||
* > | "a"
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function start(code) {
|
||||
if (code === 34 || code === 39 || code === 40) {
|
||||
effects.enter(type)
|
||||
effects.enter(markerType)
|
||||
effects.consume(code)
|
||||
effects.exit(markerType)
|
||||
marker = code === 40 ? 41 : code
|
||||
return begin
|
||||
}
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* After opening marker.
|
||||
*
|
||||
* This is also used at the closing marker.
|
||||
*
|
||||
* ```markdown
|
||||
* > | "a"
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function begin(code) {
|
||||
if (code === marker) {
|
||||
effects.enter(markerType)
|
||||
effects.consume(code)
|
||||
effects.exit(markerType)
|
||||
effects.exit(type)
|
||||
return ok
|
||||
}
|
||||
effects.enter(stringType)
|
||||
return atBreak(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* At something, before something else.
|
||||
*
|
||||
* ```markdown
|
||||
* > | "a"
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function atBreak(code) {
|
||||
if (code === marker) {
|
||||
effects.exit(stringType)
|
||||
return begin(marker)
|
||||
}
|
||||
if (code === null) {
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
// Note: blank lines can’t exist in content.
|
||||
if (markdownLineEnding(code)) {
|
||||
// To do: use `space_or_tab_eol_with_options`, connect.
|
||||
effects.enter('lineEnding')
|
||||
effects.consume(code)
|
||||
effects.exit('lineEnding')
|
||||
return factorySpace(effects, atBreak, 'linePrefix')
|
||||
}
|
||||
effects.enter('chunkString', {
|
||||
contentType: 'string'
|
||||
})
|
||||
return inside(code)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function inside(code) {
|
||||
if (code === marker || code === null || markdownLineEnding(code)) {
|
||||
effects.exit('chunkString')
|
||||
return atBreak(code)
|
||||
}
|
||||
effects.consume(code)
|
||||
return code === 92 ? escape : inside
|
||||
}
|
||||
|
||||
/**
|
||||
* After `\`, at a special character.
|
||||
*
|
||||
* ```markdown
|
||||
* > | "a\*b"
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function escape(code) {
|
||||
if (code === marker || code === 92) {
|
||||
effects.consume(code)
|
||||
return inside
|
||||
}
|
||||
return inside(code)
|
||||
}
|
||||
}
|
||||
57
node_modules/micromark-factory-title/package.json
generated
vendored
Normal file
57
node_modules/micromark-factory-title/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"name": "micromark-factory-title",
|
||||
"version": "1.1.0",
|
||||
"description": "micromark factory to parse markdown titles (found in resources, definitions)",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"micromark",
|
||||
"factory",
|
||||
"title"
|
||||
],
|
||||
"repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-title",
|
||||
"bugs": "https://github.com/micromark/micromark/issues",
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
{
|
||||
"type": "OpenCollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"types": "dev/index.d.ts",
|
||||
"files": [
|
||||
"dev/",
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"exports": {
|
||||
"types": "./dev/index.d.ts",
|
||||
"development": "./dev/index.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"micromark-factory-space": "^1.0.0",
|
||||
"micromark-util-character": "^1.0.0",
|
||||
"micromark-util-symbol": "^1.0.0",
|
||||
"micromark-util-types": "^1.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "micromark-build"
|
||||
},
|
||||
"xo": false,
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"strict": true,
|
||||
"ignoreCatch": true
|
||||
}
|
||||
}
|
||||
227
node_modules/micromark-factory-title/readme.md
generated
vendored
Normal file
227
node_modules/micromark-factory-title/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
# micromark-factory-title
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][bundle-size-badge]][bundle-size]
|
||||
[![Sponsors][sponsors-badge]][opencollective]
|
||||
[![Backers][backers-badge]][opencollective]
|
||||
[![Chat][chat-badge]][chat]
|
||||
|
||||
[micromark][] factory to parse markdown titles (found in resources,
|
||||
definitions).
|
||||
|
||||
## Contents
|
||||
|
||||
* [What is this?](#what-is-this)
|
||||
* [When should I use this?](#when-should-i-use-this)
|
||||
* [Install](#install)
|
||||
* [Use](#use)
|
||||
* [API](#api)
|
||||
* [`factoryTitle(…)`](#factorytitle)
|
||||
* [Types](#types)
|
||||
* [Compatibility](#compatibility)
|
||||
* [Security](#security)
|
||||
* [Contribute](#contribute)
|
||||
* [License](#license)
|
||||
|
||||
## What is this?
|
||||
|
||||
This package exposes states to parse titles.
|
||||
|
||||
## When should I use this?
|
||||
|
||||
This package is useful when you are making your own micromark extensions.
|
||||
|
||||
## Install
|
||||
|
||||
This package is [ESM only][esm].
|
||||
In Node.js (version 16+), install with [npm][]:
|
||||
|
||||
```sh
|
||||
npm install micromark-factory-title
|
||||
```
|
||||
|
||||
In Deno with [`esm.sh`][esmsh]:
|
||||
|
||||
```js
|
||||
import {factorySpace} from 'https://esm.sh/micromark-factory-title@1'
|
||||
```
|
||||
|
||||
In browsers with [`esm.sh`][esmsh]:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import {factorySpace} from 'https://esm.sh/micromark-factory-title@1?bundle'
|
||||
</script>
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
import {factoryTitle} from 'micromark-factory-title'
|
||||
import {codes} from 'micromark-util-symbol/codes'
|
||||
import {types} from 'micromark-util-symbol/types'
|
||||
|
||||
// A micromark tokenizer that uses the factory:
|
||||
/**
|
||||
* @this {TokenizeContext}
|
||||
* @type {Tokenizer}
|
||||
*/
|
||||
function tokenizeDefinition(effects, ok, nok) {
|
||||
return start
|
||||
|
||||
// …
|
||||
|
||||
/** @type {State} */
|
||||
function before(code) {
|
||||
if (
|
||||
code === codes.quotationMark ||
|
||||
code === codes.apostrophe ||
|
||||
code === codes.leftParenthesis
|
||||
) {
|
||||
return factoryTitle(
|
||||
effects,
|
||||
factorySpace(effects, after, types.whitespace),
|
||||
nok,
|
||||
types.definitionTitle,
|
||||
types.definitionTitleMarker,
|
||||
types.definitionTitleString
|
||||
)(code)
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
// …
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This module exports the identifier [`factoryTitle`][api-factory-title].
|
||||
There is no default export.
|
||||
|
||||
### `factoryTitle(…)`
|
||||
|
||||
Parse titles.
|
||||
|
||||
###### Examples
|
||||
|
||||
```markdown
|
||||
"a"
|
||||
'b'
|
||||
(c)
|
||||
"a
|
||||
b"
|
||||
'a
|
||||
b'
|
||||
(a\)b)
|
||||
```
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `effects` (`Effects`)
|
||||
— context
|
||||
* `ok` (`State`)
|
||||
— state switched to when successful
|
||||
* `nok` (`State`)
|
||||
— state switched to when unsuccessful
|
||||
* `type` (`string`)
|
||||
— type of the whole title (`"a"`, `'b'`, `(c)`)
|
||||
* `markerType` (`string`)
|
||||
— type for the markers (`"`, `'`, `(`, and `)`)
|
||||
* `stringType` (`string`)
|
||||
— type for the value (`a`)
|
||||
|
||||
###### Returns
|
||||
|
||||
Start state (`State`).
|
||||
|
||||
## Types
|
||||
|
||||
This package is fully typed with [TypeScript][].
|
||||
It exports no additional types.
|
||||
|
||||
## Compatibility
|
||||
|
||||
Projects maintained by the unified collective are compatible with all maintained
|
||||
versions of Node.js.
|
||||
As of now, that is Node.js 16+.
|
||||
Our projects sometimes work with older versions, but this is not guaranteed.
|
||||
|
||||
This package works with `micromark` version 3+.
|
||||
|
||||
## Security
|
||||
|
||||
This package is safe.
|
||||
See [`security.md`][securitymd] in [`micromark/.github`][health] for how to
|
||||
submit a security report.
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways
|
||||
to get started.
|
||||
See [`support.md`][support] for ways to get help.
|
||||
|
||||
This project has a [code of conduct][coc].
|
||||
By interacting with this repository, organisation, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/micromark/micromark/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/micromark/micromark
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-title.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/micromark-factory-title
|
||||
|
||||
[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-title
|
||||
|
||||
[bundle-size]: https://bundlejs.com/?q=micromark-factory-title
|
||||
|
||||
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
||||
|
||||
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
||||
|
||||
[opencollective]: https://opencollective.com/unified
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
||||
|
||||
[esmsh]: https://esm.sh
|
||||
|
||||
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
||||
|
||||
[chat]: https://github.com/micromark/micromark/discussions
|
||||
|
||||
[license]: https://github.com/micromark/micromark/blob/main/license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[health]: https://github.com/micromark/.github
|
||||
|
||||
[securitymd]: https://github.com/micromark/.github/blob/main/security.md
|
||||
|
||||
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
|
||||
|
||||
[support]: https://github.com/micromark/.github/blob/main/support.md
|
||||
|
||||
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
|
||||
|
||||
[typescript]: https://www.typescriptlang.org
|
||||
|
||||
[micromark]: https://github.com/micromark/micromark
|
||||
|
||||
[api-factory-title]: #factorytitle
|
||||
Loading…
Add table
Add a link
Reference in a new issue