mark-deco 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -44
- package/dist/cache/filesystem.d.ts +10 -0
- package/dist/cache/filesystem.d.ts.map +1 -1
- package/dist/cache/index.d.ts +10 -0
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/localstorage.d.ts +10 -0
- package/dist/cache/localstorage.d.ts.map +1 -1
- package/dist/cache/memory.d.ts +10 -0
- package/dist/cache/memory.d.ts.map +1 -1
- package/dist/fetcher.d.ts +11 -49
- package/dist/fetcher.d.ts.map +1 -1
- package/dist/frontmatter.d.ts +18 -0
- package/dist/frontmatter.d.ts.map +1 -1
- package/dist/index.cjs +25 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +867 -470
- package/dist/index.js.map +1 -1
- package/dist/internal-B7OqH3Vn.cjs +115 -0
- package/dist/internal-B7OqH3Vn.cjs.map +1 -0
- package/dist/{internal-B3t1YynJ.js → internal-BLcZHfk2.js} +3358 -3455
- package/dist/internal-BLcZHfk2.js.map +1 -0
- package/dist/internal.cjs +10 -1
- package/dist/internal.d.ts +14 -4
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +10 -1
- package/dist/logger.d.ts +10 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/plugins/card/amazon-rules.d.ts +10 -0
- package/dist/plugins/card/amazon-rules.d.ts.map +1 -1
- package/dist/plugins/card/fetcher.d.ts +10 -0
- package/dist/plugins/card/fetcher.d.ts.map +1 -1
- package/dist/plugins/card/html-generator.d.ts +10 -0
- package/dist/plugins/card/html-generator.d.ts.map +1 -1
- package/dist/plugins/card/index.d.ts +10 -0
- package/dist/plugins/card/index.d.ts.map +1 -1
- package/dist/plugins/card/ogp-rules.d.ts +10 -0
- package/dist/plugins/card/ogp-rules.d.ts.map +1 -1
- package/dist/plugins/card/rule-engine.d.ts +10 -0
- package/dist/plugins/card/rule-engine.d.ts.map +1 -1
- package/dist/plugins/card/types.d.ts +10 -0
- package/dist/plugins/card/types.d.ts.map +1 -1
- package/dist/plugins/card/utils.d.ts +10 -0
- package/dist/plugins/card/utils.d.ts.map +1 -1
- package/dist/plugins/card-plugin.d.ts +10 -0
- package/dist/plugins/card-plugin.d.ts.map +1 -1
- package/dist/plugins/mermaid/index.d.ts +10 -0
- package/dist/plugins/mermaid/index.d.ts.map +1 -1
- package/dist/plugins/mermaid/types.d.ts +10 -0
- package/dist/plugins/mermaid/types.d.ts.map +1 -1
- package/dist/plugins/mermaid-plugin.d.ts +10 -0
- package/dist/plugins/mermaid-plugin.d.ts.map +1 -1
- package/dist/plugins/oembed/fetcher.d.ts +10 -0
- package/dist/plugins/oembed/fetcher.d.ts.map +1 -1
- package/dist/plugins/oembed/html-generator.d.ts +10 -0
- package/dist/plugins/oembed/html-generator.d.ts.map +1 -1
- package/dist/plugins/oembed/index.d.ts +10 -0
- package/dist/plugins/oembed/index.d.ts.map +1 -1
- package/dist/plugins/oembed/providers.d.ts +10 -0
- package/dist/plugins/oembed/providers.d.ts.map +1 -1
- package/dist/plugins/oembed/providers.json.d.ts +298 -921
- package/dist/plugins/oembed/redirect-resolver.d.ts +10 -0
- package/dist/plugins/oembed/redirect-resolver.d.ts.map +1 -1
- package/dist/plugins/oembed/types.d.ts +10 -0
- package/dist/plugins/oembed/types.d.ts.map +1 -1
- package/dist/plugins/oembed/utils.d.ts +10 -0
- package/dist/plugins/oembed/utils.d.ts.map +1 -1
- package/dist/plugins/oembed-plugin.d.ts +10 -0
- package/dist/plugins/oembed-plugin.d.ts.map +1 -1
- package/dist/plugins/remark-attr.d.ts +10 -0
- package/dist/plugins/remark-attr.d.ts.map +1 -1
- package/dist/plugins/responsive-images.d.ts +10 -0
- package/dist/plugins/responsive-images.d.ts.map +1 -1
- package/dist/plugins/shared/error-formatter.d.ts +10 -0
- package/dist/plugins/shared/error-formatter.d.ts.map +1 -1
- package/dist/processor.d.ts +10 -0
- package/dist/processor.d.ts.map +1 -1
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/responsive-image.d.ts +10 -0
- package/dist/utils/responsive-image.d.ts.map +1 -1
- package/dist/utils.d.ts +84 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +48 -56
- package/README-package.md +0 -120
- package/dist/internal-B3t1YynJ.js.map +0 -1
- package/dist/internal-DJUdRTr2.cjs +0 -106
- package/dist/internal-DJUdRTr2.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
# MarkDeco
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Flexible Markdown to HTML conversion library.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/mark-deco)
|
|
5
6
|
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](https://github.com/kekyo/mark-deco/actions/workflows/ci.yml)
|
|
7
|
-
|
|
8
|
-
|Package|npm|
|
|
9
|
-
|:----|:----|
|
|
10
|
-
|`mark-deco`|[](https://www.npmjs.com/package/mark-deco)|
|
|
11
|
-
|`mark-deco-cli`|[](https://www.npmjs.com/package/mark-deco-cli)|
|
|
12
|
-
|
|
13
|
-
[(日本語はこちら)](./README_ja.md)
|
|
14
7
|
|
|
15
8
|
## What is this?
|
|
16
9
|
|
|
17
|
-
|
|
10
|
+
Flexible Markdown to HTML conversion library written in TypeScript.
|
|
18
11
|
It interprets GitHub Flavored Markdown (GFM) and outputs HTML.
|
|
19
12
|
Supports frontmatter parsing, heading analysis, source code formatting, oEmbed/card/Mermaid graph rendering, and custom code block processing through plugin extensions.
|
|
20
13
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
- Can be used to render HTML from Markdown input.
|
|
15
|
+
- Simple interface makes it very easy to use.
|
|
16
|
+
- Highly independent with minimal runtime requirements. Works in both Node.js and browser environments.
|
|
17
|
+
- Built-in plugins support oEmbed, cards, and Mermaid.js.
|
|
25
18
|
|
|
26
19
|
## Installation
|
|
27
20
|
|
|
@@ -41,7 +34,7 @@ const fetcher = createCachedFetcher('MyApp/1.0');
|
|
|
41
34
|
|
|
42
35
|
// Create MarkDeco processor
|
|
43
36
|
const processor = createMarkdownProcessor({
|
|
44
|
-
fetcher
|
|
37
|
+
fetcher,
|
|
45
38
|
});
|
|
46
39
|
|
|
47
40
|
// Markdown to convert
|
|
@@ -55,9 +48,7 @@ author: John Doe
|
|
|
55
48
|
This is a test article.`;
|
|
56
49
|
|
|
57
50
|
// Render HTML from Markdown input
|
|
58
|
-
const result = await processor.process(
|
|
59
|
-
markdown,
|
|
60
|
-
"id"); // ID prefix for HTML elements (described later)
|
|
51
|
+
const result = await processor.process(markdown, 'id'); // ID prefix for HTML elements (described later)
|
|
61
52
|
|
|
62
53
|
// Generated HTML
|
|
63
54
|
console.log(result.html);
|
|
@@ -74,10 +65,10 @@ This will render HTML like this:
|
|
|
74
65
|
<p>This is a test article.</p>
|
|
75
66
|
```
|
|
76
67
|
|
|
77
|
-
A "fetcher" is an abstraction for external server access. It's primarily used by oEmbed and card plugins for external API calls and page scraping.
|
|
68
|
+
A "fetcher" is an abstraction for external server access. It's primarily used by oEmbed and card plugins for external API calls and page scraping.
|
|
78
69
|
The argument passed to the fetcher is a user agent string, which is applied to HTTP request headers when accessing external servers.
|
|
79
70
|
|
|
80
|
-
HTML converted by the MarkDeco processor is formatted in a readable manner. Advanced options allow fine-tuning of formatting conditions
|
|
71
|
+
HTML converted by the MarkDeco processor is formatted in a readable manner. Advanced options allow fine-tuning of formatting conditions.
|
|
81
72
|
|
|
82
73
|
### Aborting Processor Operations
|
|
83
74
|
|
|
@@ -92,11 +83,10 @@ const abortController = new AbortController();
|
|
|
92
83
|
// ...
|
|
93
84
|
|
|
94
85
|
// Convert Markdown to HTML
|
|
95
|
-
const result = await processor.process(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
86
|
+
const result = await processor.process(markdown, 'id', {
|
|
87
|
+
// Specify processor options
|
|
88
|
+
signal: abortController.signal, // Cancellation support
|
|
89
|
+
});
|
|
100
90
|
```
|
|
101
91
|
|
|
102
92
|
For usage of `AbortController` and `AbortSignal`, refer to ECMAScript documentation.
|
|
@@ -106,32 +96,23 @@ For usage of `AbortController` and `AbortSignal`, refer to ECMAScript documentat
|
|
|
106
96
|
Although MarkDeco is a library, a CLI interface is also available in the package that allows you to easily try out MarkDeco. This allows you to try out conversions without having to write code in TypeScript, or call it as an independent application from another code.
|
|
107
97
|
|
|
108
98
|
```bash
|
|
109
|
-
# Take Markdown from standard input and output HTML
|
|
110
|
-
echo "# Hello World" | mark-deco-cli
|
|
99
|
+
# Take Markdown from standard input and output HTML
|
|
100
|
+
echo "# Hello World" | mark-deco-cli
|
|
111
101
|
```
|
|
112
102
|
|
|
113
|
-
For more information, see [CLI documentation](./docs/en/cli-application.md).
|
|
114
|
-
|
|
115
|
-
----
|
|
116
|
-
|
|
117
103
|
## Documentation
|
|
118
104
|
|
|
119
|
-
|
|
105
|
+
For detailed documentation and advanced features, please visit our [GitHub repository](https://github.com/kekyo/mark-deco).
|
|
120
106
|
|
|
121
|
-
|
|
122
|
-
- [Heading ID Generation and Heading Information Extraction](./docs/en/heading-id-generation.md) - Automatically generate unique IDs for headings with hierarchical or content-based naming strategies
|
|
123
|
-
- [Fetcher and Cache System](./docs/en/fetcher-and-cache-system.md) - External HTTP request management with configurable caching strategies for oEmbed APIs and page scraping
|
|
124
|
-
- [Built-in Plugins](./docs/en/built-in-plugins.md) - oEmbed, card, and Mermaid plugins for embedding media content, social posts, and interactive diagrams
|
|
125
|
-
- [Creating Custom Plugins](./docs/en/creating-custom-plugins.md) - Develop custom plugins to extend Markdown processing with code block interceptors and unified ecosystem integration
|
|
126
|
-
- [CLI Application](./docs/en/cli-application.md) - Command-line interface for batch processing Markdown files with configuration support and plugin control
|
|
107
|
+
Key features include:
|
|
127
108
|
|
|
128
|
-
|
|
109
|
+
- Frontmatter Information Extraction - Parse YAML frontmatter from Markdown files
|
|
110
|
+
- Heading ID Generation and Heading Information Extraction - Automatically generate unique IDs for headings
|
|
111
|
+
- Fetcher and Cache System - External HTTP request management with configurable caching
|
|
112
|
+
- Built-in Plugins - oEmbed, card, and Mermaid plugins for rich content embedding
|
|
113
|
+
- Creating Custom Plugins - Develop custom plugins to extend Markdown processing
|
|
114
|
+
- CLI Application - Command-line interface for batch processing
|
|
129
115
|
|
|
130
116
|
## License
|
|
131
117
|
|
|
132
118
|
Under MIT.
|
|
133
|
-
|
|
134
|
-
## Changelog
|
|
135
|
-
|
|
136
|
-
* 0.1.0:
|
|
137
|
-
* First public release.
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: mark-deco
|
|
3
|
+
* version: 0.6.0
|
|
4
|
+
* description: Flexible Markdown to HTML conversion library
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/mark-deco.git
|
|
8
|
+
* git.commit.hash: 31101feb1c59948ce221ebae9272f943b80c977b
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import { CacheStorage } from './index.js';
|
|
2
12
|
/**
|
|
3
13
|
* Create file system-based cache storage instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/cache/filesystem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/cache/filesystem.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAmB3D;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACvC,UAAU,MAAM,KACf,YA4OF,CAAC"}
|
package/dist/cache/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: mark-deco
|
|
3
|
+
* version: 0.6.0
|
|
4
|
+
* description: Flexible Markdown to HTML conversion library
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/mark-deco.git
|
|
8
|
+
* git.commit.hash: 31101feb1c59948ce221ebae9272f943b80c977b
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
/**
|
|
2
12
|
* Cache entry with timestamp and TTL support
|
|
3
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,4CAA4C;IAC5C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,gCAAgC;IAChC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,4BAA4B;IAC5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,uCAAuC;IACvC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAGR;AAGD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: mark-deco
|
|
3
|
+
* version: 0.6.0
|
|
4
|
+
* description: Flexible Markdown to HTML conversion library
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/mark-deco.git
|
|
8
|
+
* git.commit.hash: 31101feb1c59948ce221ebae9272f943b80c977b
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import { CacheStorage } from './index.js';
|
|
2
12
|
/**
|
|
3
13
|
* Create localStorage-based cache storage instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localstorage.d.ts","sourceRoot":"","sources":["../../src/cache/localstorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"localstorage.d.ts","sourceRoot":"","sources":["../../src/cache/localstorage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,YAAW,MAAiB,KAC3B,YAiRF,CAAC"}
|
package/dist/cache/memory.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: mark-deco
|
|
3
|
+
* version: 0.6.0
|
|
4
|
+
* description: Flexible Markdown to HTML conversion library
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/mark-deco.git
|
|
8
|
+
* git.commit.hash: 31101feb1c59948ce221ebae9272f943b80c977b
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import { CacheStorage } from './index.js';
|
|
2
12
|
/**
|
|
3
13
|
* Create in-memory cache storage instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/cache/memory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/cache/memory.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAO,YAqI3C,CAAC"}
|
package/dist/fetcher.d.ts
CHANGED
|
@@ -1,34 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: mark-deco
|
|
3
|
+
* version: 0.6.0
|
|
4
|
+
* description: Flexible Markdown to HTML conversion library
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/mark-deco.git
|
|
8
|
+
* git.commit.hash: 31101feb1c59948ce221ebae9272f943b80c977b
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import { CacheStorage } from './cache/index.js';
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
* Check if an error is likely a CORS error
|
|
5
|
-
* @param error - The error to check
|
|
6
|
-
* @returns True if the error appears to be CORS-related
|
|
7
|
-
*/
|
|
8
|
-
export declare const isCORSError: (error: unknown) => boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Create timeout signal
|
|
11
|
-
* @param timeout - Timeout duration in milliseconds
|
|
12
|
-
* @returns AbortSignal that will trigger after the specified timeout
|
|
13
|
-
*/
|
|
14
|
-
export declare const createTimeoutSignal: (timeout: number) => AbortSignal;
|
|
15
|
-
/**
|
|
16
|
-
* Combine multiple abort signals
|
|
17
|
-
* @param signals - Array of abort signals to combine
|
|
18
|
-
* @returns Combined abort signal that triggers when any input signal triggers
|
|
19
|
-
*/
|
|
20
|
-
export declare const combineAbortSignals: (...signals: AbortSignal[]) => AbortSignal;
|
|
21
|
-
/**
|
|
22
|
-
* Fetch data from a URL with specified parameters
|
|
23
|
-
* @param url - The URL to fetch from
|
|
24
|
-
* @param accept - Accept header value
|
|
25
|
-
* @param userAgent - User agent string
|
|
26
|
-
* @param timeout - Timeout duration in milliseconds
|
|
27
|
-
* @param signal - Optional abort signal
|
|
28
|
-
* @param logger - Optional logger instance
|
|
29
|
-
* @returns Promise resolving to the HTTP response
|
|
30
|
-
*/
|
|
31
|
-
export declare const fetchData: (url: string, accept: string, userAgent: string, timeout: number, signal: AbortSignal | undefined, logger?: Logger) => Promise<Response>;
|
|
12
|
+
import { FetcherType } from './types';
|
|
32
13
|
/**
|
|
33
14
|
* Options for cached fetcher
|
|
34
15
|
*/
|
|
@@ -58,23 +39,4 @@ export declare const createCachedFetcher: (userAgent: string, timeout?: number,
|
|
|
58
39
|
* @returns FetcherType object that encapsulates the fetcher and userAgent
|
|
59
40
|
*/
|
|
60
41
|
export declare const createDirectFetcher: (userAgent: string, timeout?: number) => FetcherType;
|
|
61
|
-
/**
|
|
62
|
-
* Fetch text content from a URL using the provided fetcher
|
|
63
|
-
* @param fetcherInstance - The fetcher instance to use
|
|
64
|
-
* @param url - The URL to fetch from
|
|
65
|
-
* @param accept - Accept header value
|
|
66
|
-
* @param signal - Optional abort signal
|
|
67
|
-
* @param logger - Optional logger instance
|
|
68
|
-
* @returns Promise resolving to the text content
|
|
69
|
-
*/
|
|
70
|
-
export declare const fetchText: (fetcherInstance: FetcherType, url: string, accept: string, signal: AbortSignal | undefined, logger?: Logger) => Promise<string>;
|
|
71
|
-
/**
|
|
72
|
-
* Fetch JSON content from a URL using the provided fetcher
|
|
73
|
-
* @param fetcherInstance - The fetcher instance to use
|
|
74
|
-
* @param url - The URL to fetch from
|
|
75
|
-
* @param signal - Optional abort signal
|
|
76
|
-
* @param logger - Optional logger instance
|
|
77
|
-
* @returns Promise resolving to the parsed JSON data
|
|
78
|
-
*/
|
|
79
|
-
export declare const fetchJson: <T>(fetcherInstance: FetcherType, url: string, signal: AbortSignal | undefined, logger?: Logger) => Promise<T>;
|
|
80
42
|
//# sourceMappingURL=fetcher.d.ts.map
|
package/dist/fetcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAeD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,WAAW,MAAM,EACjB,UAAS,MAAc,EACvB,eAAe,YAAY,EAC3B,UAAU,oBAAoB,KAC7B,WAsJF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,WAAW,MAAM,EACjB,UAAS,MAAc,KACtB,WAgBF,CAAC"}
|
package/dist/frontmatter.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: mark-deco
|
|
3
|
+
* version: 0.6.0
|
|
4
|
+
* description: Flexible Markdown to HTML conversion library
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/mark-deco.git
|
|
8
|
+
* git.commit.hash: 31101feb1c59948ce221ebae9272f943b80c977b
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import { FrontmatterData } from './types.js';
|
|
2
12
|
export interface ParsedFrontmatter {
|
|
3
13
|
/** Parsed frontmatter data */
|
|
@@ -11,4 +21,12 @@ export interface ParsedFrontmatter {
|
|
|
11
21
|
* @returns Parsed frontmatter data and content
|
|
12
22
|
*/
|
|
13
23
|
export declare function parseFrontmatter(content: string): ParsedFrontmatter;
|
|
24
|
+
/**
|
|
25
|
+
* Convert frontmatter data back into YAML string (excluding delimiters)
|
|
26
|
+
*/
|
|
27
|
+
export declare function stringifyFrontmatter(frontmatter: FrontmatterData): string;
|
|
28
|
+
/**
|
|
29
|
+
* Compose markdown from frontmatter data and content
|
|
30
|
+
*/
|
|
31
|
+
export declare function composeMarkdownFromParts(frontmatter: FrontmatterData, content: string): string;
|
|
14
32
|
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAsCnE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,eAAe,GAAG,MAAM,CAWzE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,eAAe,EAC5B,OAAO,EAAE,MAAM,GACd,MAAM,CAMR"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("js-beautify"),M=require("rehype-stringify"),R=require("remark-gfm"),U=require("remark-parse"),D=require("remark-rehype"),z=require("unified"),q=require("unist-util-visit"),B=require("js-yaml"),w=require("./internal-DJUdRTr2.cjs");function G(n){const t=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,a=n.match(t);if(!a)return{data:{},content:n};const o=a[1]||"",e=n.slice(a[0].length);try{const r=B.load(o);return{data:r&&typeof r=="object"&&!Array.isArray(r)?r:{},content:e}}catch(r){const i=r instanceof Error?r.message:"Unknown YAML parsing error";throw new Error(`Failed to parse frontmatter YAML: ${i}`)}}const P=()=>{},J={debug:P,info:P,warn:P,error:P},K={debug:console.debug,info:console.info,warn:console.warn,error:console.error},j=()=>J,W=()=>K,C=n=>{const t={},a=n.slice(1,-1).trim(),o=a.match(/\.([a-zA-Z0-9_-]+)/g);if(o){const i=o.map(p=>p.slice(1));t.class=i.join(" ")}const e=a.match(/#([a-zA-Z0-9_-]+)/);e&&e[1]&&(t.id=e[1]);const r=a.match(/([a-zA-Z0-9_-]+)=["']?([^"'\s]*)["']?/g);if(r)for(const i of r){const[p,d]=i.split("=");p&&d&&p!=="class"&&p!=="id"&&(t[p]=d.replace(/["']/g,""))}return t},V=n=>{const t=n.lang?` class="language-${n.lang}"`:"",a=n.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return`<pre><code${t}>${a}</code></pre>`},x=(n,t)=>{n.data||(n.data={}),n.data.hProperties||(n.data.hProperties={}),Object.entries(t).forEach(([a,o])=>{if(a==="class"){const e=n.data.hProperties.class;e?typeof e=="string"&&e.startsWith("language-")?n.data.hProperties.class=`${e} ${o}`:n.data.hProperties.class=`${e} ${o}`:n.data.hProperties.class=o}else n.data.hProperties[a]=o})},Y=()=>n=>{q.visit(n,(t,a,o)=>{if(t.type==="heading"&&t.children?.length>0){const e=t.children[t.children.length-1];if(e?.type==="text"&&e.value){const r=e.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);if(r){const i=r[1].trim(),p=r[2],d=C(p);e.value=i,x(t,d)}}}if(t.type==="paragraph"&&t.children?.length>0){const e=t.children[t.children.length-1];if(e?.type==="text"&&e.value){const r=e.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);if(r){const i=r[1].trim(),p=r[2],d=C(p);e.value=i,x(t,d)}}}if(t.type==="link"&&o&&typeof a=="number"){const e=o.children[a+1];if(e?.type==="text"&&e.value){const r=e.value.match(/^\s*(\{[^}]+\})/);if(r){const i=r[1],p=C(i);x(t,p),e.value=e.value.replace(r[0],"")}}}if(t.type==="image"&&o&&typeof a=="number"){const e=o.children[a+1];if(e?.type==="text"&&e.value){const r=e.value.match(/^\s*(\{[^}]+\})/);if(r){const i=r[1],p=C(i);x(t,p),e.value=e.value.replace(r[0],"")}}}if(t.type==="listItem"&&t.children?.length>0){const e=t.children[t.children.length-1];if(e?.type==="paragraph"&&e.children?.length>0){const r=e.children[e.children.length-1];if(r?.type==="text"&&r.value){const i=r.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);if(i){const p=i[1].trim(),d=i[2],s=C(d);r.value=p,x(t,s)}}}}if(t.type==="list"&&o&&typeof a=="number"){const e=o.children[a+1];if(e?.type==="paragraph"&&e.children?.length===1){const r=e.children[0];if(r?.type==="text"&&r.value){const i=r.value.match(/^\s*(\{[^}]+\})\s*$/);if(i){const p=i[1],d=C(p);x(t,d),o.children.splice(a+1,1)}}}}if(t.type==="blockquote"&&t.children?.length>0){const e=t.children[t.children.length-1];if(e?.type==="paragraph"&&e.children?.length>0){const r=e.children[e.children.length-1];if(r?.type==="text"&&r.value){const i=r.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);if(i){const p=i[1].trim(),d=i[2],s=C(d);r.value=p,x(t,s)}}}}if(t.type==="blockquote"&&o&&typeof a=="number"){const e=o.children[a+1];if(e?.type==="paragraph"&&e.children?.length===1){const r=e.children[0];if(r?.type==="text"&&r.value){const i=r.value.match(/^\s*(\{[^}]+\})\s*$/);if(i){const p=i[1],d=C(p);x(t,d),o.children.splice(a+1,1)}}}}if(t.type==="inlineCode"&&o&&typeof a=="number"){const e=o.children[a+1];if(e?.type==="text"&&e.value){const r=e.value.match(/^\s*(\{[^}]+\})/);if(r){const i=r[1],p=C(i);x(t,p),e.value=e.value.replace(r[0],"")}}}if(t.type==="code"&&t.meta){const e=t.meta.match(/\{([^}]+)\}/);if(e){const r=`{${e[1]}}`,i=C(r),p={type:"html",value:`<div class="${i.class||""}" ${Object.entries(i).filter(([d])=>d!=="class").map(([d,s])=>`${d}="${s}"`).join(" ")}>${V(t)}</div>`};o&&typeof a=="number"&&(o.children[a]=p),t.meta=t.meta.replace(e[0],"").trim()||null}}})},Z=()=>n=>{q.visit(n,"element",t=>{if(t.tagName==="img"){const a=w.generateResponsiveImageStyles();t.properties||(t.properties={});const o=t.properties.style||"",e=o?`${o}; ${a}`:a;t.properties.style=e}})},{html:Q}=T,A={indent_size:2,indent_char:" ",max_preserve_newlines:2,preserve_newlines:!0,end_with_newline:!1,wrap_line_length:0,indent_inner_html:!0,indent_empty_lines:!1,unformatted:["code","pre","textarea"],content_unformatted:["pre","code","textarea"],extra_liners:[]},L=n=>n.type==="text"||n.type==="inlineCode"?n.value||"":n.children&&Array.isArray(n.children)?n.children.map(L).join(""):"",X=(n,t)=>`${n}-${t.join("-")}`,tt=n=>{const t=[],a=[];for(const o of n){const e=o.level;for(;a.length>e;)a.pop();for(;a.length<e;)a.push(0);const r=e-1;a[r]=(a[r]||0)+1;const i=a.slice(0,e);t.push({level:o.level,text:o.text,numbers:i})}return t},et=(n,t,a)=>{const r=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/\\[nrtbfv0]/g,"-").replace(/[\x00-\x1F\x7F-\x9F]/g,"-").replace(/[^\x20-\x7E]/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");return r.length>=3?`${n}-${r}`:a()},rt=n=>{const t=[],a=[];for(const o of n){const e={level:o.level,text:o.text,id:o.id,children:[]};for(;a.length>0;){const r=a[a.length-1];if(r&&r.level>=o.level)a.pop();else break}if(a.length===0)t.push(e);else{const r=a[a.length-1];r&&r.children.push(e)}a.push(e)}return t},at=n=>{const{plugins:t=[],logger:a=j(),fetcher:o}=n,e=new Map;for(const s of t){if(e.has(s.name))throw new Error(`Plugin with name '${s.name}' is already registered`);e.set(s.name,s)}const r=async(s,h,l)=>{const c=e.get(s);return c?await c.processBlock(h,l):`<pre><code class="language-${s}">${w.escapeHtml(h)}</code></pre>`},i=(s,h,l)=>{const c={logger:a,signal:h,frontmatter:s,getUniqueId:l,fetcher:o};return()=>async f=>{const u=[];q.visit(f,"code",(m,y,v)=>{if(!m.lang||!e.has(m.lang))return;const k=(async()=>{const g={type:"html",value:await r(m.lang,m.value,c)};v&&typeof y=="number"&&(v.children[y]=g)})();u.push(k)}),await Promise.all(u)}},p=(s,h,l=!1,c=!1,f="")=>()=>u=>{const m=[],y=[];q.visit(u,"heading",g=>{g.depth>=1&&g.depth<=6&&y.push(g)});let v=[];if(l){const g=y.map(H=>({level:H.depth,text:L(H)}));v=tt(g)}const k=[];y.forEach((g,H)=>{const I=L(g),N=g.data?.hProperties?.id;let S;if(N)S=N;else if(l&&c){const $=h(I).replace(`${f}-`,"");for(;k.length>0;){const O=k[k.length-1];if(O&&O.level>=g.depth)k.pop();else break}const F=k.map(O=>O.contentId);S=F.length>0?`${f}-${F.join("-")}-${$}`:`${f}-${$}`,k.push({level:g.depth,contentId:$})}else if(l&&H<v.length){const $=v[H];$?S=X(f,$.numbers):S=h(I)}else S=h(I);g.data||(g.data={}),g.data.hProperties||(g.data.hProperties={}),N||(g.data.hProperties.id=S),m.push({level:g.depth,text:I,id:S})});const b=rt(m);s.push(...b)};return{process:async(s,h,{signal:l,useContentStringHeaderId:c=!1,useHierarchicalHeadingId:f=!0,advancedOptions:u}={})=>{const{allowDangerousHtml:m=!0,htmlOptions:y=A,gfmOptions:v={},remarkPlugins:k=[],rehypePlugins:b=[]}=u||{};try{const{data:g,content:H}=G(s),I=[];let N=0;const S=()=>`${h}-${++N}`;let $=z.unified().use(U);if(k)for(const E of k)Array.isArray(E)?$=$.use(E[0],E[1]):$=$.use(E);let F=$.use(R,v).use(Y).use(p(I,c?E=>et(h,E,S):S,f,c,h)).use(i(g,l,S)).use(D,{allowDangerousHtml:m}).use(Z).use(M,{allowDangerousHtml:m});if(b)for(const E of b)Array.isArray(E)?F=F.use(E[0],E[1]):F=F.use(E);const _=await F.process(H),O=String(_);return{html:Q(O,y),frontmatter:g,headingTree:I}}catch(g){throw a.error(`Failed to process markdown: ${g instanceof Error?g.message:"Unknown error"}`),new Error(`Failed to process markdown: ${g instanceof Error?g.message:"Unknown error"}`)}}}},nt=(n="cache:")=>{const t=w.createAsyncLock(),a=()=>{try{return typeof window<"u"&&typeof window.localStorage<"u"&&window.localStorage!==null}catch{return!1}},o=async()=>{if(!a())return;const s=Date.now(),h=[];for(let l=0;l<localStorage.length;l++){const c=localStorage.key(l);if(!c||!c.startsWith(n))continue;const f=localStorage.getItem(c);if(f)try{const u=JSON.parse(f);u.ttl!==void 0&&(u.ttl===0||s>u.timestamp+u.ttl)&&h.push(c)}catch{h.push(c)}}for(const l of h)localStorage.removeItem(l)};return{get:async s=>{if(!a())throw new Error("localStorage is not available in this environment");const h=n+s,l=localStorage.getItem(h);if(!l)return null;let c;try{c=JSON.parse(l)}catch{const f=await t.lock();try{return localStorage.removeItem(h),null}finally{f.release()}}if(c.ttl!==void 0&&(c.ttl===0||Date.now()>c.timestamp+c.ttl)){const u=await t.lock();try{const m=Date.now();return(c.ttl===0||m>c.timestamp+c.ttl)&&localStorage.removeItem(h),null}finally{u.release()}}return c.data},set:async(s,h,l)=>{if(!a())throw new Error("localStorage is not available in this environment");const c=n+s,f={data:h,timestamp:Date.now()};l!==void 0&&(f.ttl=l);const u=JSON.stringify(f),m=await t.lock();try{try{localStorage.setItem(c,u)}catch(y){if(y instanceof Error&&y.name==="QuotaExceededError"){await o();try{localStorage.setItem(c,u)}catch(v){throw new Error(`Failed to store cache entry: ${v}`)}}else throw new Error(`Failed to store cache entry: ${y}`)}}finally{m.release()}},delete:async s=>{if(!a())throw new Error("localStorage is not available in this environment");const h=n+s,l=await t.lock();try{localStorage.removeItem(h)}finally{l.release()}},clear:async()=>{if(!a())throw new Error("localStorage is not available in this environment");const s=[];for(let l=0;l<localStorage.length;l++){const c=localStorage.key(l);c&&c.startsWith(n)&&s.push(c)}if(s.length===0)return;const h=await t.lock();try{for(const l of s)localStorage.removeItem(l)}finally{h.release()}},size:async()=>{if(!a())throw new Error("localStorage is not available in this environment");const s=[];for(let l=0;l<localStorage.length;l++){const c=localStorage.key(l);c&&c.startsWith(n)&&s.push(c)}if(s.length===0)return 0;const h=await t.lock();try{const l=Date.now();let c=0;for(const f of s){const u=localStorage.getItem(f);if(u)try{const m=JSON.parse(u);if(m.ttl!==void 0&&(m.ttl===0||l>m.timestamp+m.ttl)){localStorage.removeItem(f);continue}c++}catch{localStorage.removeItem(f)}}return c}finally{h.release()}}}},st=async n=>{try{const a=require("crypto").createHash("sha256");return a.update(n,"utf8"),a.digest("hex")}catch(t){throw new Error(`Failed to generate hash: ${t}`)}},ot=n=>{if(typeof window<"u")throw new Error("File system cache is only available in Node.js environment, not in browsers");const t=w.createAsyncLock(),a=async s=>`${await st(s)}.json`,o=async()=>{try{const{promises:s}=require("fs");await s.mkdir(n,{recursive:!0})}catch(s){if(s.code!=="EEXIST")throw new Error(`Failed to create cache directory: ${s}`)}};return{get:async s=>{const h=await a(s);try{await o()}catch(m){throw new Error(`Failed to ensure cache directory: ${m}`)}const{promises:l}=require("fs"),f=require("path").join(n,h);let u;try{const m=await l.readFile(f,"utf-8");u=JSON.parse(m)}catch{return null}if(u.ttl!==void 0&&(u.ttl===0||Date.now()>u.timestamp+u.ttl)){const y=await t.lock();try{const v=Date.now();return(u.ttl===0||v>u.timestamp+u.ttl)&&await l.unlink(f),null}catch{return null}finally{y.release()}}return u.data},set:async(s,h,l)=>{const c=await a(s),f={data:h,timestamp:Date.now()};l!==void 0&&(f.ttl=l);const u=JSON.stringify(f,null,2),m=await t.lock();try{await o();const{promises:y}=require("fs"),k=require("path").join(n,c);try{await y.writeFile(k,u,"utf-8")}catch(b){throw new Error(`Failed to write cache entry: ${b}`)}}catch(y){throw new Error(`Failed to import required modules: ${y}`)}finally{m.release()}},delete:async s=>{const h=await a(s),l=await t.lock();try{await o();const{promises:c}=require("fs"),u=require("path").join(n,h);try{await c.unlink(u)}catch{}}catch(c){throw new Error(`Failed to import required modules: ${c}`)}finally{l.release()}},clear:async()=>{const s=await t.lock();try{await o();const{promises:h}=require("fs"),l=require("path"),f=(await h.readdir(n)).filter(u=>u.endsWith(".json"));for(const u of f){const m=l.join(n,u);try{await h.unlink(m)}catch{}}}catch(h){throw new Error(`Failed to import required modules: ${h}`)}finally{s.release()}},size:async()=>{await o();const{promises:s}=require("fs"),h=require("path"),c=(await s.readdir(n)).filter(u=>u.endsWith(".json"));if(c.length===0)return 0;const f=await t.lock();try{const u=Date.now();let m=0;for(const y of c){const v=h.join(n,y);try{const k=await s.readFile(v,"utf8"),b=JSON.parse(k);if(b.ttl!==void 0&&(b.ttl===0||u>b.timestamp+b.ttl)){await s.unlink(v);continue}m++}catch{try{await s.unlink(v)}catch{}}}return m}catch(u){throw new Error(`Failed to import required modules: ${u}`)}finally{f.release()}}}},ct=(n,t={})=>{const{maxRedirects:a=5,timeoutEachRedirect:o=1e4}=t;return{name:"oembed",processBlock:async(r,i)=>{const p=r.trim();if(!w.isValidUrl(p))throw new Error(`Invalid URL: ${p}`);try{const d=await w.fetchOEmbedData(p,a,o,i,n);return w.generateHtml(d,p,t)}catch(d){i.logger.warn("oEmbed fetch failed for URL:",p,d);const s=w.formatErrorInfo(d);return w.generateFallbackHtml(p,s)}}}},it=(n={})=>({name:"card",processBlock:async(a,o)=>{const e=a.trim();if(!w.isValidUrl$1(e))throw new Error(`Invalid URL: ${e}`);try{const r=await w.fetchMetadata(e,n,o);return w.generateCardHtml(r,e,n)}catch(r){o.logger.warn("Card plugin fetch failed for URL:",e,r);const i=w.formatErrorInfo(r);return w.generateFallbackHtml$1(e,i)}}}),lt=(n={})=>{const{className:t="mermaid",includeId:a=!0}=n;return{name:"mermaid",processBlock:async(e,r)=>{const i=e.trim();if(!i){r.logger.warn("Mermaid plugin received empty content");const h=a?` id="${r.getUniqueId()}"`:"";return`<div class="${t}-wrapper">
|
|
1
|
+
/*!
|
|
2
|
+
* name: mark-deco
|
|
3
|
+
* version: 0.6.0
|
|
4
|
+
* description: Flexible Markdown to HTML conversion library
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/mark-deco.git
|
|
8
|
+
* git.commit.hash: 31101feb1c59948ce221ebae9272f943b80c977b
|
|
9
|
+
*/
|
|
10
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const tt=require("js-beautify"),et=require("rehype-stringify"),rt=require("remark-gfm"),nt=require("remark-parse"),at=require("remark-rehype"),st=require("unified"),R=require("unist-util-visit"),G=require("js-yaml"),k=require("./internal-B7OqH3Vn.cjs");function ot(e){const t=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,r=e.match(t);if(!r)return{data:{},content:e};const s=r[1]||"",n=e.slice(r[0].length);try{const a=G.load(s);return{data:a&&typeof a=="object"&&!Array.isArray(a)?a:{},content:n}}catch(a){const h=a instanceof Error?a.message:"Unknown YAML parsing error";throw new Error(`Failed to parse frontmatter YAML: ${h}`)}}function ct(e){if(!e||Object.keys(e).length===0)return"";const t=G.dump(e,{lineWidth:0});return typeof t!="string"||t.length===0?"":t.endsWith(`
|
|
11
|
+
`)?t:`${t}
|
|
12
|
+
`}function it(e,t){const r=t??"";return`${`---
|
|
13
|
+
${ct(e)}---
|
|
14
|
+
`}${r}`}const T=()=>{},lt={debug:T,info:T,warn:T,error:T},ht={debug:console.debug,info:console.info,warn:console.warn,error:console.error},V=()=>lt,ut=()=>ht,x=e=>{const t={},r=e.slice(1,-1).trim(),s=r.match(/\.([a-zA-Z0-9_-]+)/g);if(s){const h=s.map(p=>p.slice(1));t.class=h.join(" ")}const n=r.match(/#([a-zA-Z0-9_-]+)/);n&&n[1]&&(t.id=n[1]);const a=r.match(/([a-zA-Z0-9_-]+)=["']?([^"'\s]*)["']?/g);if(a)for(const h of a){const[p,d]=h.split("=");p&&d&&p!=="class"&&p!=="id"&&(t[p]=d.replace(/["']/g,""))}return t},ft=e=>{const t=e.lang?` class="language-${e.lang}"`:"",r=e.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return`<pre><code${t}>${r}</code></pre>`},H=(e,t)=>{e.data||(e.data={}),e.data.hProperties||(e.data.hProperties={}),Object.entries(t).forEach(([r,s])=>{if(r==="class"){const n=e.data.hProperties.class;n?typeof n=="string"&&n.startsWith("language-")?e.data.hProperties.class=`${n} ${s}`:e.data.hProperties.class=`${n} ${s}`:e.data.hProperties.class=s}else e.data.hProperties[r]=s})},dt=()=>e=>{R.visit(e,(t,r,s)=>{if(t.type==="heading"&&t.children?.length>0){const n=t.children[t.children.length-1];if(n?.type==="text"&&n.value){const a=n.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);if(a){const h=a[1].trim(),p=a[2],d=x(p);n.value=h,H(t,d)}}}if(t.type==="paragraph"&&t.children?.length>0){const n=t.children[t.children.length-1];if(n?.type==="text"&&n.value){const a=n.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);if(a){const h=a[1].trim(),p=a[2],d=x(p);n.value=h,H(t,d)}}}if(t.type==="link"&&s&&typeof r=="number"){const n=s.children[r+1];if(n?.type==="text"&&n.value){const a=n.value.match(/^\s*(\{[^}]+\})/);if(a){const h=a[1],p=x(h);H(t,p),n.value=n.value.replace(a[0],"")}}}if(t.type==="image"&&s&&typeof r=="number"){const n=s.children[r+1];if(n?.type==="text"&&n.value){const a=n.value.match(/^\s*(\{[^}]+\})/);if(a){const h=a[1],p=x(h);H(t,p),n.value=n.value.replace(a[0],"")}}}if(t.type==="listItem"&&t.children?.length>0){const n=t.children[t.children.length-1];if(n?.type==="paragraph"&&n.children?.length>0){const a=n.children[n.children.length-1];if(a?.type==="text"&&a.value){const h=a.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);if(h){const p=h[1].trim(),d=h[2],o=x(d);a.value=p,H(t,o)}}}}if(t.type==="list"&&s&&typeof r=="number"){const n=s.children[r+1];if(n?.type==="paragraph"&&n.children?.length===1){const a=n.children[0];if(a?.type==="text"&&a.value){const h=a.value.match(/^\s*(\{[^}]+\})\s*$/);if(h){const p=h[1],d=x(p);H(t,d),s.children.splice(r+1,1)}}}}if(t.type==="blockquote"&&t.children?.length>0){const n=t.children[t.children.length-1];if(n?.type==="paragraph"&&n.children?.length>0){const a=n.children[n.children.length-1];if(a?.type==="text"&&a.value){const h=a.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);if(h){const p=h[1].trim(),d=h[2],o=x(d);a.value=p,H(t,o)}}}}if(t.type==="blockquote"&&s&&typeof r=="number"){const n=s.children[r+1];if(n?.type==="paragraph"&&n.children?.length===1){const a=n.children[0];if(a?.type==="text"&&a.value){const h=a.value.match(/^\s*(\{[^}]+\})\s*$/);if(h){const p=h[1],d=x(p);H(t,d),s.children.splice(r+1,1)}}}}if(t.type==="inlineCode"&&s&&typeof r=="number"){const n=s.children[r+1];if(n?.type==="text"&&n.value){const a=n.value.match(/^\s*(\{[^}]+\})/);if(a){const h=a[1],p=x(h);H(t,p),n.value=n.value.replace(a[0],"")}}}if(t.type==="code"&&t.meta){const n=t.meta.match(/\{([^}]+)\}/);if(n){const a=`{${n[1]}}`,h=x(a),p={type:"html",value:`<div class="${h.class||""}" ${Object.entries(h).filter(([d])=>d!=="class").map(([d,o])=>`${d}="${o}"`).join(" ")}>${ft(t)}</div>`};s&&typeof r=="number"&&(s.children[r]=p),t.meta=t.meta.replace(n[0],"").trim()||null}}})},pt=()=>e=>{R.visit(e,"element",t=>{if(t.tagName==="img"){const r=k.generateResponsiveImageStyles();t.properties||(t.properties={});const s=t.properties.style||"",n=s?`${s}; ${r}`:r;t.properties.style=n}})},{html:mt}=tt,Q={indent_size:2,indent_char:" ",max_preserve_newlines:2,preserve_newlines:!0,end_with_newline:!1,wrap_line_length:0,indent_inner_html:!0,indent_empty_lines:!1,unformatted:["code","pre","textarea"],content_unformatted:["pre","code","textarea"],extra_liners:[]},yt=e=>{const t=r=>{if(r instanceof Date)return new Date(r.getTime());if(Array.isArray(r))return r.map(t);if(r&&typeof r=="object"){const s={};for(const[n,a]of Object.entries(r))s[n]=t(a);return s}return r};return t(e??{})},M=e=>{if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(M);if(e&&typeof e=="object"){const t=Object.entries(e).filter(([,s])=>s!==void 0).sort(([s],[n])=>s<n?-1:s>n?1:0),r={};for(const[s,n]of t)r[s]=M(n);return r}return e},J=e=>JSON.stringify(M(e??{})),U=e=>e.type==="text"||e.type==="inlineCode"?e.value||"":e.children&&Array.isArray(e.children)?e.children.map(U).join(""):"",gt=(e,t)=>`${e}-${t.join("-")}`,wt=e=>{const t=[],r=[];for(const s of e){const n=s.level;for(;r.length>n;)r.pop();for(;r.length<n;)r.push(0);const a=n-1;r[a]=(r[a]||0)+1;const h=r.slice(0,n);t.push({level:s.level,text:s.text,numbers:h})}return t},B=(e,t,r)=>{const s=k.generateHeadingId(t);return s!==void 0?`${e}-${s}`:r()},vt=e=>{const t=[],r=[];for(const s of e){const n={level:s.level,text:s.text,id:s.id,children:[]};for(;r.length>0;){const a=r[r.length-1];if(a&&a.level>=s.level)r.pop();else break}if(r.length===0)t.push(n);else{const a=r[r.length-1];a&&a.children.push(n)}r.push(n)}return t},kt=e=>{const{plugins:t=[],logger:r=V(),fetcher:s}=e,n=new Map;for(const o of t){if(n.has(o.name))throw new Error(`Plugin with name '${o.name}' is already registered`);n.set(o.name,o)}const a=async(o,c,i)=>{const l=n.get(o);return l?await l.processBlock(c,i):`<pre><code class="language-${o}">${k.escapeHtml(c)}</code></pre>`},h=(o,c,i)=>{const l={logger:r,signal:c,frontmatter:o,getUniqueId:i,fetcher:s};return()=>async u=>{const f=[];R.visit(u,"code",(m,y,w)=>{if(!m.lang||!n.has(m.lang))return;const g=(async()=>{const v={type:"html",value:await a(m.lang,m.value,l)};w&&typeof y=="number"&&(w.children[y]=v)})();f.push(g)}),await Promise.all(f)}},p=(o,c,i=!1,l=!1,u="")=>()=>f=>{const m=[],y=[];R.visit(f,"heading",v=>{v.depth>=1&&v.depth<=6&&y.push(v)});let w=[];if(i){const v=y.map($=>({level:$.depth,text:U($)}));w=wt(v)}const g=[];y.forEach((v,$)=>{const F=U(v),O=v.data?.hProperties?.id;let S;if(O)S=O;else if(i&&l){const C=B(u,F,()=>c(F)).replace(`${u}-`,"");for(;g.length>0;){const L=g[g.length-1];if(L&&L.level>=v.depth)g.pop();else break}const I=g.map(L=>L.contentId);S=I.length>0?`${u}-${I.join("-")}-${C}`:`${u}-${C}`,g.push({level:v.depth,contentId:C})}else if(i&&$<w.length){const C=w[$];C?S=gt(u,C.numbers):S=c(F)}else S=c(F);v.data||(v.data={}),v.data.hProperties||(v.data.hProperties={}),O||(v.data.hProperties.id=S),m.push({level:v.depth,text:F,id:S})});const E=vt(m);o.push(...E)};return{process:async(o,c,{signal:i,useContentStringHeaderId:l=!1,useHierarchicalHeadingId:u=!0,advancedOptions:f,frontmatterTransform:m}={})=>{const{allowDangerousHtml:y=!0,htmlOptions:w=Q,gfmOptions:g={},remarkPlugins:E=[],rehypePlugins:v=[]}=f||{};try{const $=o,{data:F,content:O}=ot(o);let S=F;const C=J(F);let I=!1;if(m){const b={originalFrontmatter:yt(F),markdownContent:O},j=m(b);j!==void 0&&(S=j,I=J(j)!==C)}const A=[];let L=0;const D=()=>`${c}-${++L}`;let N=st.unified().use(nt);if(E)for(const b of E)Array.isArray(b)?N=N.use(b[0],b[1]):N=N.use(b);let P=N.use(rt,g).use(dt).use(p(A,l?b=>B(c,b,D):D,u,l,c)).use(h(S,i,D)).use(at,{allowDangerousHtml:y}).use(pt).use(et,{allowDangerousHtml:y});if(v)for(const b of v)Array.isArray(b)?P=P.use(b[0],b[1]):P=P.use(b);const Z=await P.process(O),X=String(Z);return{html:mt(X,w),frontmatter:S,changed:I,headingTree:A,composeMarkdown:()=>I?it(S,O):$}}catch($){throw r.error(`Failed to process markdown: ${$ instanceof Error?$.message:"Unknown error"}`),new Error(`Failed to process markdown: ${$ instanceof Error?$.message:"Unknown error"}`)}}}},bt=(e,t={})=>{const{maxRedirects:r=5,timeoutEachRedirect:s=1e4}=t;return{name:"oembed",processBlock:async(a,h)=>{const p=a.trim();if(!k.isValidUrl(p))throw new Error(`Invalid URL: ${p}`);try{const d=await k.fetchOEmbedData(p,r,s,h,e);return k.generateHtml(d,p,t)}catch(d){h.logger.warn("oEmbed fetch failed for URL:",p,d);const o=k.formatErrorInfo(d);return k.generateFallbackHtml(p,o)}}}},Et=(e={})=>({name:"card",processBlock:async(r,s)=>{const n=r.trim();if(!k.isValidUrl$1(n))throw new Error(`Invalid URL: ${n}`);try{const a=await k.fetchMetadata(n,e,s);return k.generateCardHtml(a,n,e)}catch(a){s.logger.warn("Card plugin fetch failed for URL:",n,a);const h=k.formatErrorInfo(a);return k.generateFallbackHtml$1(n,h)}}}),$t=(e={})=>{const{className:t="mermaid",includeId:r=!0}=e;return{name:"mermaid",processBlock:async(n,a)=>{const h=n.trim();if(!h){a.logger.warn("Mermaid plugin received empty content");const c=r?` id="${a.getUniqueId()}"`:"";return`<div class="${t}-wrapper">
|
|
2
15
|
<style>
|
|
3
16
|
.${t}-wrapper .${t} > svg {
|
|
4
17
|
width: auto !important;
|
|
@@ -6,8 +19,8 @@
|
|
|
6
19
|
max-width: none !important;
|
|
7
20
|
}
|
|
8
21
|
</style>
|
|
9
|
-
<div class="${t}"${
|
|
10
|
-
</div>`}const p=
|
|
22
|
+
<div class="${t}"${c}><!-- Empty mermaid content --></div>
|
|
23
|
+
</div>`}const p=r?` id="${a.getUniqueId()}"`:"",d=h.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),o=`<div class="${t}-wrapper">
|
|
11
24
|
<style>
|
|
12
25
|
.${t}-wrapper .${t} > svg {
|
|
13
26
|
width: auto !important;
|
|
@@ -16,5 +29,13 @@
|
|
|
16
29
|
}
|
|
17
30
|
</style>
|
|
18
31
|
<div class="${t}"${p}>${d}</div>
|
|
19
|
-
</div>`;return
|
|
32
|
+
</div>`;return a.logger.debug("Mermaid plugin processed content:",{contentLength:h.length,className:t,includeId:r}),o}}};/*!
|
|
33
|
+
* name: async-primitives
|
|
34
|
+
* version: 1.2.0
|
|
35
|
+
* description: A collection of primitive functions for asynchronous operations
|
|
36
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
37
|
+
* license: MIT
|
|
38
|
+
* repository.url: https://github.com/kekyo/async-primitives.git
|
|
39
|
+
* git.commit.hash: 3b7bffeaa8ae47aea6e8b0ef0f70e265a6d9ab08
|
|
40
|
+
*/const K=()=>{},W={release:K,[Symbol.dispose]:K},St=(e,t)=>{if(!e)return W;if(e.aborted){try{t()}catch(a){console.warn("AbortHook callback error: ",a)}return W}let r;r=()=>{if(r){e.removeEventListener("abort",r),r=void 0;try{t()}catch(a){console.warn("AbortHook callback error: ",a)}}};const s=()=>{r&&(e.removeEventListener("abort",r),r=void 0)};return e.addEventListener("abort",r,{once:!0}),{release:s,[Symbol.dispose]:s}},xt=e=>{typeof setImmediate=="function"?setImmediate(e):setTimeout(e,0)},q=()=>new Error("Lock acquisition was aborted"),Ft=e=>{let t=!0;const r=()=>{t&&(t=!1,e())};return{get isActive(){return t},release:r,[Symbol.dispose]:r}},z=(e=20)=>{let t=!1;const r=[];let s=0;const n=()=>{var c;if(t||r.length===0)return;const i=r.shift();if((c=i.signal)!=null&&c.aborted){i.reject(q()),a();return}t=!0;const l=Ft(h);i.resolve(l)},a=()=>{s++,s>=e?(s=0,xt(n)):n()},h=()=>{t&&(t=!1,a())},p=c=>{const i=r.indexOf(c);i!==-1&&r.splice(i,1)},d=async c=>{if(c){if(c.aborted)throw q();return new Promise((i,l)=>{const u={resolve:void 0,reject:void 0,signal:c},f=St(c,()=>{p(u),l(q())});u.resolve=m=>{f.release(),i(m)},u.reject=m=>{f.release(),l(m)},r.push(u),n()})}else return new Promise((i,l)=>{r.push({resolve:i,reject:l}),n()})};return{lock:d,waiter:{wait:d},get isLocked(){return t},get pendingCount(){return r.length}}},Ht=(e="cache:")=>{const t=z(),r=()=>{try{return typeof window<"u"&&typeof window.localStorage<"u"&&window.localStorage!==null}catch{return!1}},s=async()=>{if(!r())return;const o=Date.now(),c=[];for(let i=0;i<localStorage.length;i++){const l=localStorage.key(i);if(!l||!l.startsWith(e))continue;const u=localStorage.getItem(l);if(u)try{const f=JSON.parse(u);f.ttl!==void 0&&(f.ttl===0||o>f.timestamp+f.ttl)&&c.push(l)}catch{c.push(l)}}for(const i of c)localStorage.removeItem(i)};return{get:async o=>{if(!r())throw new Error("localStorage is not available in this environment");const c=e+o,i=localStorage.getItem(c);if(!i)return null;let l;try{l=JSON.parse(i)}catch{const u=await t.lock();try{return localStorage.removeItem(c),null}finally{u.release()}}if(l.ttl!==void 0&&(l.ttl===0||Date.now()>l.timestamp+l.ttl)){const f=await t.lock();try{const m=Date.now();return(l.ttl===0||m>l.timestamp+l.ttl)&&localStorage.removeItem(c),null}finally{f.release()}}return l.data},set:async(o,c,i)=>{if(!r())throw new Error("localStorage is not available in this environment");const l=e+o,u={data:c,timestamp:Date.now()};i!==void 0&&(u.ttl=i);const f=JSON.stringify(u),m=await t.lock();try{try{localStorage.setItem(l,f)}catch(y){if(y instanceof Error&&y.name==="QuotaExceededError"){await s();try{localStorage.setItem(l,f)}catch(w){throw new Error(`Failed to store cache entry: ${w}`)}}else throw new Error(`Failed to store cache entry: ${y}`)}}finally{m.release()}},delete:async o=>{if(!r())throw new Error("localStorage is not available in this environment");const c=e+o,i=await t.lock();try{localStorage.removeItem(c)}finally{i.release()}},clear:async()=>{if(!r())throw new Error("localStorage is not available in this environment");const o=[];for(let i=0;i<localStorage.length;i++){const l=localStorage.key(i);l&&l.startsWith(e)&&o.push(l)}if(o.length===0)return;const c=await t.lock();try{for(const i of o)localStorage.removeItem(i)}finally{c.release()}},size:async()=>{if(!r())throw new Error("localStorage is not available in this environment");const o=[];for(let i=0;i<localStorage.length;i++){const l=localStorage.key(i);l&&l.startsWith(e)&&o.push(l)}if(o.length===0)return 0;const c=await t.lock();try{const i=Date.now();let l=0;for(const u of o){const f=localStorage.getItem(u);if(f)try{const m=JSON.parse(f);if(m.ttl!==void 0&&(m.ttl===0||i>m.timestamp+m.ttl)){localStorage.removeItem(u);continue}l++}catch{localStorage.removeItem(u)}}return l}finally{c.release()}}}},Y=()=>{const e=new Map,t=z(),r=(d=Date.now())=>{const o=[];for(const[c,i]of e.entries())i.ttl!==void 0&&(i.ttl===0||d>i.timestamp+i.ttl)&&o.push(c);for(const c of o)e.delete(c);return o};return{get:async d=>{const o=e.get(d);if(!o)return null;if(o.ttl!==void 0&&(o.ttl===0||Date.now()>o.timestamp+o.ttl)){const i=await t.lock();try{const l=e.get(d);if(l&&l.ttl!==void 0){const u=Date.now();(l.ttl===0||u>l.timestamp+l.ttl)&&e.delete(d)}return null}finally{i.release()}}return o.data},set:async(d,o,c)=>{const i={data:o,timestamp:Date.now()};c!==void 0&&(i.ttl=c);const l=await t.lock();try{e.set(d,i)}finally{l.release()}},delete:async d=>{const o=await t.lock();try{e.delete(d)}finally{o.release()}},clear:async()=>{const d=await t.lock();try{e.clear()}finally{d.release()}},size:async()=>{if(Array.from(e.entries()).length===0)return 0;const o=await t.lock();try{return r(),e.size}finally{o.release()}}}},Ct=async e=>{try{const r=require("crypto").createHash("sha256");return r.update(e,"utf8"),r.digest("hex")}catch(t){throw new Error(`Failed to generate hash: ${t}`)}},Ot=e=>{if(typeof window<"u")throw new Error("File system cache is only available in Node.js environment, not in browsers");const t=z(),r=async o=>`${await Ct(o)}.json`,s=async()=>{try{const{promises:o}=require("fs");await o.mkdir(e,{recursive:!0})}catch(o){if(o.code!=="EEXIST")throw new Error(`Failed to create cache directory: ${o}`)}};return{get:async o=>{const c=await r(o);try{await s()}catch(m){throw new Error(`Failed to ensure cache directory: ${m}`)}const{promises:i}=require("fs"),u=require("path").join(e,c);let f;try{const m=await i.readFile(u,"utf-8");f=JSON.parse(m)}catch{return null}if(f.ttl!==void 0&&(f.ttl===0||Date.now()>f.timestamp+f.ttl)){const y=await t.lock();try{const w=Date.now();return(f.ttl===0||w>f.timestamp+f.ttl)&&await i.unlink(u),null}catch{return null}finally{y.release()}}return f.data},set:async(o,c,i)=>{const l=await r(o),u={data:c,timestamp:Date.now()};i!==void 0&&(u.ttl=i);const f=JSON.stringify(u,null,2),m=await t.lock();try{await s();const{promises:y}=require("fs"),g=require("path").join(e,l);try{await y.writeFile(g,f,"utf-8")}catch(E){throw new Error(`Failed to write cache entry: ${E}`)}}catch(y){throw new Error(`Failed to import required modules: ${y}`)}finally{m.release()}},delete:async o=>{const c=await r(o),i=await t.lock();try{await s();const{promises:l}=require("fs"),f=require("path").join(e,c);try{await l.unlink(f)}catch{}}catch(l){throw new Error(`Failed to import required modules: ${l}`)}finally{i.release()}},clear:async()=>{const o=await t.lock();try{await s();const{promises:c}=require("fs"),i=require("path"),u=(await c.readdir(e)).filter(f=>f.endsWith(".json"));for(const f of u){const m=i.join(e,f);try{await c.unlink(m)}catch{}}}catch(c){throw new Error(`Failed to import required modules: ${c}`)}finally{o.release()}},size:async()=>{await s();const{promises:o}=require("fs"),c=require("path"),l=(await o.readdir(e)).filter(f=>f.endsWith(".json"));if(l.length===0)return 0;const u=await t.lock();try{const f=Date.now();let m=0;for(const y of l){const w=c.join(e,y);try{const g=await o.readFile(w,"utf8"),E=JSON.parse(g);if(E.ttl!==void 0&&(E.ttl===0||f>E.timestamp+E.ttl)){await o.unlink(w);continue}m++}catch{try{await o.unlink(w)}catch{}}}return m}catch(f){throw new Error(`Failed to import required modules: ${f}`)}finally{u.release()}}}};function _(e,t,r){return`fetch:${e}:${t}:${r||"default"}`}const It=(e,t=6e4,r,s)=>{const{cache:n=!0,cacheTTL:a=3600*1e3,cacheFailures:h=!0,failureCacheTTL:p=300*1e3}=s||{},d=n?r||Y():void 0;return{rawFetcher:async(c,i,l,u)=>{if(n&&d){const y=_(c,i,e),w=await d.get(y);if(w)try{const g=JSON.parse(w);if(g.type==="success")return u?.info(`Cache HIT (success) for URL: ${c}`),new Response(g.data,{status:200,statusText:"OK",headers:{"Content-Type":i,"X-Cache":"HIT"}});if(g.type==="error"&&h)throw u?.info(`Cache HIT (error) for URL: ${c}`),new Error("Cached error");u?.debug(`Cache entry type ${g.type} not eligible for use, cacheFailures: ${h}`)}catch(g){if(u?.warn(`Failed to parse cached entry for URL ${c}:`,g),g instanceof SyntaxError)u?.debug("JSON parse error, continuing to network fetch");else throw g}else u?.info(`Cache MISS for URL: ${c}`)}let f,m=null;try{f=await k.fetchData(c,i,e,t,l,u)}catch(y){if(m=y,n&&d&&h)try{const w=_(c,i,e),g={type:"error",data:"",error:{message:m.message,...m.message.includes("HTTP error, status:")&&{status:parseInt(m.message.match(/status: (\d+)/)?.[1]||"0")}},timestamp:Date.now()};await d.set(w,JSON.stringify(g),p),u?.debug(`Cached error for URL: ${c}`)}catch(w){u?.warn(`Failed to cache error for URL ${c}:`,w),console.warn("Failed to cache error:",w)}throw m}if(n&&d&&f.ok)try{const y=await f.clone().text(),w=_(c,i,e),g={type:"success",data:y,timestamp:Date.now()};await d.set(w,JSON.stringify(g),a),u?.debug(`Cached successful response for URL: ${c}`)}catch(y){u?.warn(`Failed to cache response for URL ${c}:`,y),console.warn("Failed to cache response:",y)}return f},userAgent:e}},Lt=(e,t=6e4)=>({rawFetcher:async(s,n,a,h)=>(h?.debug(`Direct fetch for URL: ${s}`),await k.fetchData(s,n,e,t,a,h)),userAgent:e});exports.defaultProviderList=k.defaultProviderList;exports.fetchData=k.fetchData;exports.fetchJson=k.fetchJson;exports.fetchText=k.fetchText;exports.generateHeadingId=k.generateHeadingId;exports.createCachedFetcher=It;exports.createCardPlugin=Et;exports.createDirectFetcher=Lt;exports.createFileSystemCacheStorage=Ot;exports.createLocalCacheStorage=Ht;exports.createMarkdownProcessor=kt;exports.createMemoryCacheStorage=Y;exports.createMermaidPlugin=$t;exports.createOEmbedPlugin=bt;exports.defaultHtmlOptions=Q;exports.generateCacheKey=_;exports.getConsoleLogger=ut;exports.getNoOpLogger=V;
|
|
20
41
|
//# sourceMappingURL=index.cjs.map
|