├── .changeset
├── README.md
└── config.json
├── .github
└── workflows
│ ├── autofix.yml
│ ├── integration.yml
│ └── release.yml
├── .gitignore
├── .prettierignore
├── .prettierrc.cjs
├── .vscode
├── extensions.json
└── settings.json
├── LICENSE
├── README.md
├── docs
├── README.md
├── astro.config.ts
├── astro.no-caption.config.ts
├── package.json
├── public
│ └── favicon.svg
├── src
│ ├── assets
│ │ ├── demo
│ │ │ ├── algorithm.jpg
│ │ │ ├── blackboard.jpg
│ │ │ ├── bridge.jpg
│ │ │ ├── mug.jpg
│ │ │ └── paper.jpg
│ │ ├── showcase
│ │ │ ├── aoi.js.org.png
│ │ │ ├── docs.astronvim.com.png
│ │ │ ├── docs.testomat.io.png
│ │ │ ├── events-3bg.pages.dev.png
│ │ │ ├── userdocs.github.io-qbittorrent-nox-static.png
│ │ │ └── wiki.atlauncher.com.png
│ │ └── tests
│ │ │ ├── astro-light.svg
│ │ │ ├── large.jpg
│ │ │ ├── starlight-light.png
│ │ │ └── text.jpg
│ ├── components
│ │ └── ImageAttribution.astro
│ ├── content.config.ts
│ ├── content
│ │ └── docs
│ │ │ ├── configuration.md
│ │ │ ├── customization.mdx
│ │ │ ├── demo.mdx
│ │ │ ├── getting-started.mdx
│ │ │ ├── ignoring-images.mdx
│ │ │ ├── index.mdx
│ │ │ ├── resources
│ │ │ ├── showcase.mdx
│ │ │ └── starlight.mdx
│ │ │ └── tests
│ │ │ ├── data-zoom-id.md
│ │ │ ├── hero.mdx
│ │ │ ├── large.md
│ │ │ ├── not-content.md
│ │ │ ├── shared-syntax.md
│ │ │ ├── shared-syntax.mdx
│ │ │ ├── specific-syntax.md
│ │ │ ├── specific-syntax.mdx
│ │ │ ├── text.md
│ │ │ ├── zoom-off.mdx
│ │ │ └── zoom.mdx
│ ├── env.d.ts
│ └── styles
│ │ └── custom.css
└── tsconfig.json
├── eslint.config.mjs
├── package.json
├── packages
└── starlight-image-zoom
│ ├── .npmignore
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── components
│ └── ImageZoom.astro
│ ├── eslint.config.mjs
│ ├── index.ts
│ ├── libs
│ ├── constants.ts
│ ├── integration.ts
│ ├── rehype.ts
│ └── vite.ts
│ ├── overrides
│ └── MarkdownContent.astro
│ ├── package.json
│ ├── playwright.config.ts
│ ├── tests
│ ├── fixtures
│ │ └── TestPage.ts
│ ├── interaction.test.ts
│ ├── no-caption.test.ts
│ ├── shared-syntax.test.ts
│ ├── specific-syntax.test.ts
│ ├── test.ts
│ └── zoom.test.ts
│ ├── tsconfig.json
│ └── virtual.d.ts
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
└── tsconfig.json
/.changeset/README.md:
--------------------------------------------------------------------------------
1 | # Changesets
2 |
3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4 | with multi-package repos, or single-package repos to help you version and publish your code. You can
5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6 |
7 | We have a quick list of common questions to get you started engaging with this project in
8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
9 |
--------------------------------------------------------------------------------
/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@3.0.4/schema.json",
3 | "changelog": [
4 | "@changesets/changelog-github",
5 | { "repo": "HiDeoo/starlight-image-zoom" }
6 | ],
7 | "commit": false,
8 | "access": "public",
9 | "baseBranch": "main",
10 | "updateInternalDependencies": "patch",
11 | "ignore": ["starlight-image-zoom-docs"]
12 | }
13 |
--------------------------------------------------------------------------------
/.github/workflows/autofix.yml:
--------------------------------------------------------------------------------
1 | name: autofix.ci
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 | branches:
9 | - main
10 | workflow_call:
11 |
12 | permissions:
13 | contents: read
14 |
15 | concurrency:
16 | cancel-in-progress: true
17 | group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
18 |
19 | jobs:
20 | autofix:
21 | name: Format code
22 | runs-on: ubuntu-latest
23 | steps:
24 | - name: Checkout
25 | uses: actions/checkout@v4
26 |
27 | - name: Install pnpm
28 | uses: pnpm/action-setup@v4
29 |
30 | - name: Install Node.js
31 | uses: actions/setup-node@v4
32 | with:
33 | cache: pnpm
34 | node-version: 18
35 |
36 | - name: Install dependencies
37 | run: pnpm install
38 |
39 | - name: Format code
40 | run: pnpm format
41 |
42 | - name: Run autofix
43 | uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c
44 | with:
45 | fail-fast: false
46 |
--------------------------------------------------------------------------------
/.github/workflows/integration.yml:
--------------------------------------------------------------------------------
1 | name: integration
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 | branches:
9 | - main
10 | workflow_call:
11 |
12 | concurrency:
13 | cancel-in-progress: true
14 | group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
15 |
16 | jobs:
17 | lint_test:
18 | name: Lint & Test
19 | runs-on: ubuntu-latest
20 | steps:
21 | - name: Checkout
22 | uses: actions/checkout@v4
23 |
24 | - name: Install pnpm
25 | uses: pnpm/action-setup@v4
26 |
27 | - name: Install Node.js
28 | uses: actions/setup-node@v4
29 | with:
30 | cache: pnpm
31 | node-version: 18
32 |
33 | - name: Install dependencies
34 | run: pnpm install
35 |
36 | - name: Generates docs TypeScript types
37 | run: pnpm astro sync
38 | working-directory: docs
39 |
40 | - name: Lint
41 | run: pnpm lint
42 |
43 | - name: Test
44 | run: pnpm test
45 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: release
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 |
8 | jobs:
9 | changeset:
10 | name: Changeset
11 | if: ${{ github.repository_owner == 'hideoo' }}
12 | runs-on: ubuntu-latest
13 | permissions:
14 | contents: write
15 | id-token: write
16 | pull-requests: write
17 | steps:
18 | - name: Checkout
19 | uses: actions/checkout@v4
20 | with:
21 | fetch-depth: 0
22 |
23 | - name: Install pnpm
24 | uses: pnpm/action-setup@v4
25 |
26 | - name: Install Node.js
27 | uses: actions/setup-node@v4
28 | with:
29 | cache: pnpm
30 | node-version: 18
31 |
32 | - name: Install dependencies
33 | run: pnpm install
34 |
35 | - name: Create Release Pull Request or Publish
36 | uses: changesets/action@v1
37 | with:
38 | version: pnpm run version
39 | publish: pnpm changeset publish
40 | commit: 'ci: release'
41 | title: 'ci: release'
42 | env:
43 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
45 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .astro
2 | .DS_Store
3 | .eslintcache
4 | .idea
5 | .next
6 | .turbo
7 | .vercel
8 | .vscode/*
9 | !.vscode/extensions.json
10 | !.vscode/launch.json
11 | !.vscode/settings.json
12 | !.vscode/tasks.json
13 | .vscode-test
14 | .vscode-test-web
15 | *.local
16 | *.log
17 | *.pem
18 | *.tsbuildinfo
19 | build
20 | coverage
21 | dist
22 | dist-no-caption
23 | dist-ssr
24 | lerna-debug.log*
25 | logs
26 | next-env.d.ts
27 | node_modules
28 | npm-debug.log*
29 | out
30 | pnpm-debug.log*
31 | releases
32 | test-results
33 | yarn-debug.log*
34 | yarn-error.log*
35 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | .astro
2 | .changeset
3 | .github/blocks
4 | .next
5 | .vercel
6 | .vscode-test
7 | .vscode-test-web
8 | build
9 | coverage
10 | dist
11 | dist-ssr
12 | out
13 | pnpm-lock.yaml
14 |
15 | # The content of this file should match the one from the `shared-syntax-md.md` file.
16 | docs/src/content/docs/tests/shared-syntax.mdx
17 |
--------------------------------------------------------------------------------
/.prettierrc.cjs:
--------------------------------------------------------------------------------
1 | const baseConfig = require('@hideoo/prettier-config')
2 |
3 | /**
4 | * @type {import('prettier').Config}
5 | */
6 | const prettierConfig = {
7 | ...baseConfig,
8 | overrides: [
9 | {
10 | files: '*.astro',
11 | options: {
12 | parser: 'astro',
13 | },
14 | },
15 | ],
16 | plugins: [require.resolve('prettier-plugin-astro')],
17 | }
18 |
19 | module.exports = prettierConfig
20 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
3 | }
4 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "eslint.useFlatConfig": true,
3 | "eslint.validate": [
4 | "javascript",
5 | "javascriptreact",
6 | "typescript",
7 | "typescriptreact",
8 | "html",
9 | "vue",
10 | "markdown",
11 | "astro"
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024-present, HiDeoo
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | packages/starlight-image-zoom/README.md
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 |
2 |
starlight-image-zoom 🕵️
3 |
Starlight plugin adding zoom capabilities to your documentation images.
4 |
5 |
6 |
15 |
16 | ## Documentation
17 |
18 | Run the documentation locally using [pnpm](https://pnpm.io):
19 |
20 | ```shell
21 | pnpm run dev
22 | ```
23 |
24 | ## License
25 |
26 | Licensed under the MIT License, Copyright © HiDeoo.
27 |
28 | See [LICENSE](https://github.com/HiDeoo/starlight-image-zoom/blob/main/LICENSE) for more information.
29 |
--------------------------------------------------------------------------------
/docs/astro.config.ts:
--------------------------------------------------------------------------------
1 | import starlight from '@astrojs/starlight'
2 | import { defineConfig } from 'astro/config'
3 | import starlightImageZoom from 'starlight-image-zoom'
4 |
5 | export default defineConfig({
6 | integrations: [
7 | starlight({
8 | customCss: ['./src/styles/custom.css'],
9 | editLink: {
10 | baseUrl: 'https://github.com/HiDeoo/starlight-image-zoom/edit/main/docs/',
11 | },
12 | plugins: [starlightImageZoom()],
13 | sidebar: [
14 | {
15 | label: 'Start Here',
16 | items: [
17 | { label: 'Getting Started', link: '/getting-started/' },
18 | { label: 'Configuration', link: '/configuration/' },
19 | ],
20 | },
21 | {
22 | label: 'Guides',
23 | items: [
24 | { label: 'Ignoring Images', link: '/ignoring-images/' },
25 | { label: 'Customization', link: '/customization/' },
26 | ],
27 | },
28 | {
29 | label: 'Resources',
30 | items: [
31 | { label: 'Showcase', link: '/resources/showcase/' },
32 | { label: 'Plugins and Tools', link: '/resources/starlight/' },
33 | ],
34 | },
35 | { label: 'Demo', link: '/demo/' },
36 | ],
37 | social: {
38 | blueSky: 'https://bsky.app/profile/hideoo.dev',
39 | github: 'https://github.com/HiDeoo/starlight-image-zoom',
40 | },
41 | title: 'Starlight Image Zoom',
42 | }),
43 | ],
44 | })
45 |
--------------------------------------------------------------------------------
/docs/astro.no-caption.config.ts:
--------------------------------------------------------------------------------
1 | import starlight from '@astrojs/starlight'
2 | import { defineConfig } from 'astro/config'
3 | import starlightImageZoom from 'starlight-image-zoom'
4 |
5 | export default defineConfig({
6 | base: '/no-caption/',
7 | integrations: [
8 | starlight({
9 | plugins: [starlightImageZoom({ showCaptions: false })],
10 | title: 'Starlight Image Zoom No Caption Example',
11 | }),
12 | ],
13 | outDir: './dist-no-caption',
14 | server: {
15 | port: 4322,
16 | },
17 | })
18 |
--------------------------------------------------------------------------------
/docs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "starlight-image-zoom-docs",
3 | "version": "0.9.0",
4 | "license": "MIT",
5 | "description": "Starlight plugin adding zoom capabilities to your documentation images.",
6 | "author": "HiDeoo (https://hideoo.dev)",
7 | "type": "module",
8 | "scripts": {
9 | "dev": "astro dev",
10 | "dev:no-caption": "astro dev --config astro.no-caption.config.ts",
11 | "build": "astro build",
12 | "build:no-caption": "astro build --config astro.no-caption.config.ts",
13 | "preview": "astro preview",
14 | "preview:no-caption": "astro preview --config astro.no-caption.config.ts",
15 | "lint": "eslint . --cache --max-warnings=0"
16 | },
17 | "dependencies": {
18 | "@astrojs/starlight": "^0.32.0",
19 | "@hideoo/starlight-plugins-docs-components": "^0.4.0",
20 | "astro": "^5.3.0",
21 | "sharp": "^0.33.5",
22 | "starlight-image-zoom": "workspace:*"
23 | },
24 | "engines": {
25 | "node": ">=18"
26 | },
27 | "packageManager": "pnpm@8.15.4",
28 | "private": true,
29 | "sideEffects": false,
30 | "keywords": [
31 | "starlight",
32 | "image",
33 | "zoom",
34 | "documentation",
35 | "image-zoom"
36 | ],
37 | "homepage": "https://github.com/HiDeoo/starlight-image-zoom",
38 | "repository": {
39 | "type": "git",
40 | "url": "https://github.com/HiDeoo/starlight-image-zoom.git",
41 | "directory": "docs"
42 | },
43 | "bugs": "https://github.com/HiDeoo/starlight-image-zoom/issues"
44 | }
45 |
--------------------------------------------------------------------------------
/docs/public/favicon.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/docs/src/assets/demo/algorithm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/demo/algorithm.jpg
--------------------------------------------------------------------------------
/docs/src/assets/demo/blackboard.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/demo/blackboard.jpg
--------------------------------------------------------------------------------
/docs/src/assets/demo/bridge.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/demo/bridge.jpg
--------------------------------------------------------------------------------
/docs/src/assets/demo/mug.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/demo/mug.jpg
--------------------------------------------------------------------------------
/docs/src/assets/demo/paper.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/demo/paper.jpg
--------------------------------------------------------------------------------
/docs/src/assets/showcase/aoi.js.org.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/showcase/aoi.js.org.png
--------------------------------------------------------------------------------
/docs/src/assets/showcase/docs.astronvim.com.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/showcase/docs.astronvim.com.png
--------------------------------------------------------------------------------
/docs/src/assets/showcase/docs.testomat.io.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/showcase/docs.testomat.io.png
--------------------------------------------------------------------------------
/docs/src/assets/showcase/events-3bg.pages.dev.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/showcase/events-3bg.pages.dev.png
--------------------------------------------------------------------------------
/docs/src/assets/showcase/userdocs.github.io-qbittorrent-nox-static.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/showcase/userdocs.github.io-qbittorrent-nox-static.png
--------------------------------------------------------------------------------
/docs/src/assets/showcase/wiki.atlauncher.com.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/showcase/wiki.atlauncher.com.png
--------------------------------------------------------------------------------
/docs/src/assets/tests/astro-light.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/docs/src/assets/tests/large.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/tests/large.jpg
--------------------------------------------------------------------------------
/docs/src/assets/tests/starlight-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/tests/starlight-light.png
--------------------------------------------------------------------------------
/docs/src/assets/tests/text.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HiDeoo/starlight-image-zoom/b71545b645e1ccc82f1bda33f49c34db14a73aa5/docs/src/assets/tests/text.jpg
--------------------------------------------------------------------------------
/docs/src/components/ImageAttribution.astro:
--------------------------------------------------------------------------------
1 | ---
2 | interface Props {
3 | id: string
4 | name: string
5 | username: string
6 | }
7 |
8 | const { id, name, username } = Astro.props
9 | ---
10 |
11 |
12 | Photo by
15 | {name}
16 | on
19 | Unsplash
20 |
21 |
22 |
23 |
31 |
--------------------------------------------------------------------------------
/docs/src/content.config.ts:
--------------------------------------------------------------------------------
1 | import { docsLoader } from '@astrojs/starlight/loaders'
2 | import { docsSchema } from '@astrojs/starlight/schema'
3 | import { defineCollection } from 'astro:content'
4 |
5 | export const collections = {
6 | docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
7 | }
8 |
--------------------------------------------------------------------------------
/docs/src/content/docs/configuration.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Configuration
3 | description: An overview of all the configuration options supported by the Starlight Image Zoom plugin.
4 | ---
5 |
6 | The Starlight Image Zoom plugin can be configured inside the `astro.config.mjs` configuration file of your project:
7 |
8 | ```js {11}
9 | // astro.config.mjs
10 | import starlight from '@astrojs/starlight'
11 | import { defineConfig } from 'astro/config'
12 | import starlightImageZoom from 'starlight-image-zoom'
13 |
14 | export default defineConfig({
15 | integrations: [
16 | starlight({
17 | plugins: [
18 | starlightImageZoom({
19 | // Configuration options go here.
20 | }),
21 | ],
22 | title: 'My Docs',
23 | }),
24 | ],
25 | })
26 | ```
27 |
28 | ## Configuration options
29 |
30 | The Starlight Image Zoom plugin accepts the following configuration options:
31 |
32 | ### `showCaptions`
33 |
34 | **Type:** `boolean`
35 | **Default:** `true`
36 |
37 | Whether an image alternate text should be displayed as a caption when the image is zoomed.
38 | Disabling this options is useful if you are already using another approach to display captions.
39 |
--------------------------------------------------------------------------------
/docs/src/content/docs/customization.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Customization
3 | description: Learn how to customize the appearance of zoomed images.
4 | ---
5 |
6 | Zoomed images are displayed in a modal [`