File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,13 +16,40 @@ export type {
1616 LqipFormat ,
1717} from './loader.js'
1818
19+ /**
20+ * The plugin options, they will be merged with {@linkcode DEFAULT_OPTIONS}
21+ *
22+ * @example
23+ *
24+ * ```typescript
25+ * const config: Config = {
26+ * plugins: [
27+ * [
28+ * 'native-ideal-image',
29+ * {
30+ * presets: {
31+ * card: {
32+ * sizes: [600, 800, 1000],
33+ * formats: ['avif', 'webp', 'jpeg'],
34+ * },
35+ * },
36+ * disableInDev: true,
37+ * } satisfies NativeIdealImageOptions,
38+ * ],
39+ * ],
40+ * }
41+ * ```
42+ */
1943export type NativeIdealImageOptions = Partial < {
2044 /**
2145 * File name template for output files
2246 */
2347 fileNameTemplate : string
2448 /**
25- * Image loader presets
49+ * Image loader presets, you can use them through URL queries like this:
50+ * `import image from 'ideal-img!./some-image.png?preset=card'`
51+ *
52+ * `default` preset is used when there's no preset query
2653 */
2754 presets : Record < string , Preset >
2855 /**
Original file line number Diff line number Diff line change @@ -4,13 +4,42 @@ import type { Parent } from 'unist'
44import { visit , EXIT } from 'unist-util-visit'
55import { assetRequireAttributeValue , transformNode } from './utils.js'
66
7+ /**
8+ * The remark plugin options
9+ *
10+ * @example
11+ *
12+ * ```typescript
13+ * const config = {
14+ * presets: [
15+ * [
16+ * 'classic',
17+ * {
18+ * // The same for docs and blog
19+ * pages: {
20+ * remarkPlugins: [
21+ * [
22+ * nativeIdealImageRemarkPlugin,
23+ * {
24+ * swapOnLoad: true,
25+ * } satisfies NativeIdealImageRemarkPluginOptions,
26+ * ],
27+ * ],
28+ * },
29+ * },
30+ * ],
31+ * ],
32+ * }
33+ * ```
34+ */
735export type RemarkPluginOptions = Partial < {
836 /**
937 * The image loader preset to use
1038 */
1139 preset : string
1240 /**
13- * Swap (fade in) the actual image after it's fully loaded
41+ * Swap (fade in) the actual image after it's fully loaded,
42+ * this corresponds to `NativeIdealImageProps.swapOnLoad`
1443 */
1544 swapOnLoad : boolean
1645} >
You can’t perform that action at this time.
0 commit comments