🎉 initiate project *astro_rewrite*

This commit is contained in:
sindrekjelsrud 2023-07-19 21:31:30 +02:00
parent ffd4d5e86c
commit 2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions

40
node_modules/remark-rehype/lib/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,40 @@
export default remarkRehype
export type HastRoot = import('hast').Root
export type MdastRoot = import('mdast').Root
export type Options = import('mdast-util-to-hast').Options
export type Processor = import('unified').Processor<any, any, any, any>
export type DoNotTouchAsThisImportIncludesRawInTree =
typeof import('mdast-util-to-hast')
/**
* Plugin that turns markdown into HTML to support rehype.
*
* * If a destination processor is given, that processor runs with a new HTML
* (hast) tree (bridge-mode).
* As the given processor runs with a hast tree, and rehype plugins support
* hast, that means rehype plugins can be used with the given processor.
* The hast tree is discarded in the end.
* Its highly unlikely that you want to do this.
* * The common case is to not pass a destination processor, in which case the
* current processor continues running with a new HTML (hast) tree
* (mutate-mode).
* As the current processor continues with a hast tree, and rehype plugins
* support hast, that means rehype plugins can be used after
* `remark-rehype`.
* Its likely that this is what you want to do.
*
* @param destination
* Optional unified processor.
* @param options
* Options passed to `mdast-util-to-hast`.
*/
declare const remarkRehype: import('unified').Plugin<
| [
import('unified').Processor<any, any, any, any>,
(import('mdast-util-to-hast/lib').Options | undefined)?
]
| [null | undefined, (import('mdast-util-to-hast/lib').Options | undefined)?]
| [import('mdast-util-to-hast/lib').Options]
| [],
import('mdast').Root,
import('mdast').Root
>

71
node_modules/remark-rehype/lib/index.js generated vendored Normal file
View file

@ -0,0 +1,71 @@
/**
* @typedef {import('hast').Root} HastRoot
* @typedef {import('mdast').Root} MdastRoot
* @typedef {import('mdast-util-to-hast').Options} Options
* @typedef {import('unified').Processor<any, any, any, any>} Processor
*
* @typedef {import('mdast-util-to-hast')} DoNotTouchAsThisImportIncludesRawInTree
*/
import {toHast} from 'mdast-util-to-hast'
// Note: the `<MdastRoot, HastRoot>` overload doesnt seem to work :'(
/**
* Plugin that turns markdown into HTML to support rehype.
*
* * If a destination processor is given, that processor runs with a new HTML
* (hast) tree (bridge-mode).
* As the given processor runs with a hast tree, and rehype plugins support
* hast, that means rehype plugins can be used with the given processor.
* The hast tree is discarded in the end.
* Its highly unlikely that you want to do this.
* * The common case is to not pass a destination processor, in which case the
* current processor continues running with a new HTML (hast) tree
* (mutate-mode).
* As the current processor continues with a hast tree, and rehype plugins
* support hast, that means rehype plugins can be used after
* `remark-rehype`.
* Its likely that this is what you want to do.
*
* @param destination
* Optional unified processor.
* @param options
* Options passed to `mdast-util-to-hast`.
*/
const remarkRehype =
/** @type {(import('unified').Plugin<[Processor, Options?]|[null|undefined, Options?]|[Options]|[], MdastRoot>)} */
(
function (destination, options) {
return destination && 'run' in destination
? bridge(destination, options)
: mutate(destination || options)
}
)
export default remarkRehype
/**
* Bridge-mode.
* Runs the destination with the new hast tree.
*
* @type {import('unified').Plugin<[Processor, Options?], MdastRoot>}
*/
function bridge(destination, options) {
return (node, file, next) => {
destination.run(toHast(node, options), file, (error) => {
next(error)
})
}
}
/**
* Mutate-mode.
* Further plugins run on the hast tree.
*
* @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>}
*/
function mutate(options) {
// @ts-expect-error: assume a corresponding node is returned by `toHast`.
return (node) => toHast(node, options)
}