vitepress-linkcard 1.2.2 → 1.2.4

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/dist/.cjs.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * vitepress-linkcard v1.2.2
2
+ * vitepress-linkcard v1.2.4
3
3
  * (c) 2022 - 2025 luckrya
4
4
  * Released under the MIT License.
5
5
  */
package/dist/.esm.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * vitepress-linkcard v1.2.2
2
+ * vitepress-linkcard v1.2.4
3
3
  * (c) 2022 - 2025 luckrya
4
4
  * Released under the MIT License.
5
5
  */
@@ -0,0 +1,41 @@
1
+ # CONTRIBUTING
2
+
3
+ Always welcome.
4
+
5
+ ## Environment
6
+
7
+ [mise](https://mise.jdx.dev/) is recommended.
8
+
9
+ ```shell
10
+ mise install # Load .config/mise.toml and install tools
11
+
12
+ yarn install # Install dependencies
13
+
14
+ yarn dlx @yarnpkg/sdks vscode # If you develop with VScode
15
+ ```
16
+
17
+ ## Branch rule
18
+
19
+ `main` branch can only be pushed from Pull Requests.
20
+
21
+ ## CI/CD
22
+
23
+ | Task | When | Action | On local |
24
+ |----------------|---------------|---------------------------------------------------------------------------------------------|----------------|
25
+ | ESLint | PR is opened | Block merge until errors are resolved | `yarn lint` |
26
+ | Prettier | PR is merged | Format files and push them on `HEAD` | `yarn format` |
27
+ | Publish to npm | PR is merged | Publish package to [npmjs](https://www.npmjs.com/package/vitepress-linkcard) | - |
28
+ | TypeDoc | PR is merged | Build and deploy docs to [GitHub Pages](https://asumo-1xts.github.io/vitepress-linkcard/) | `yarn docs` |
29
+
30
+ ## devDependencies
31
+
32
+ > [!WARNING]
33
+ > To avoid build failures, these packages must not be updated any further.
34
+ >
35
+ > | Package | Version |
36
+ > |--------------------|-----------|
37
+ > | @types/markdown-it | ^13.0.2 |
38
+ > | markdown-it | ^13.0.2 |
39
+ > | rollup | ^2.79.2 |
40
+ >
41
+ > Of course, this restriction does not apply if you modify the source code of this plugin appropriately.
package/docs/README.md ADDED
@@ -0,0 +1,111 @@
1
+ <h1 align="center">
2
+ vitepress-linkcard
3
+ </h1>
4
+
5
+ <div align="center">
6
+
7
+ **A Vitepress plugin to generate a pretty linkcard with OGP.**
8
+
9
+ Slightly more readable README created with this plugin is [here](https://asumoranda.com/posts/10-vitepress-linkcard.html).
10
+
11
+ [![NPM Version](https://img.shields.io/npm/v/vitepress-linkcard?style=flat&logo=npm&logoColor=white&label=npmjs&color=%23CB3837)](https://www.npmjs.com/package/vitepress-linkcard)
12
+ [![NPM bundle size](https://img.shields.io/bundlephobia/min/vitepress-linkcard)](https://www.npmjs.com/package/vitepress-linkcard)
13
+ [![NPM License](https://img.shields.io/npm/l/vitepress-linkcard)](/LICENSE)
14
+
15
+ [![VitePress](https://img.shields.io/badge/For_VitePress-v1.6.4-%235C73E7?logo=vitepress&logoColor=white)](https://vuejs.github.io/vitepress/v1/)
16
+ [![Yarn](https://img.shields.io/badge/Built_with_Yarn-v4.9.2-%232C8EBB?logo=yarn&logoColor=white)](https://yarnpkg.com/)
17
+ [![ESLint](https://img.shields.io/badge/Lint_with-ESLint-%234B32C3?style=flat&logo=eslint&logoColor=white&labelColor=gray)](https://github.com/asumo-1xts/vitepress-linkcard/actions/workflows/eslint.yml)
18
+ [![Prettier](https://img.shields.io/badge/Format_with-Prettier-%23F7B93E?style=flat&logo=prettier&logoColor=white&labelColor=gray)](https://github.com/asumo-1xts/vitepress-linkcard/actions/workflows/prettier.yml)
19
+
20
+ <img src="https://github.com/asumo-1xts/vitepress-linkcard/blob/main/docs/screen.webp?raw=true" width=90% alt="How it shows" />
21
+
22
+ This plugin was forked from [markdown-it-link-to-card](https://github.com/luckrya/markdown-it-link-to-card).
23
+
24
+ </div>
25
+
26
+ ## Getting started
27
+
28
+ ### Install
29
+
30
+ ```shell
31
+ npm i -D vitepress-linkcard # npm
32
+ yarn add -D vitepress-linkcard # yarn
33
+ pnpm add -D vitepress-linkcard # pnpm
34
+ ```
35
+
36
+ ### Usage
37
+
38
+ #### `docs/.vitepress/config.ts`
39
+
40
+ ```ts
41
+ import { defineConfig } from "vitepress";
42
+ import { linkToCardPlugin } from "vitepress-linkcard";
43
+ import type { LinkToCardPluginOptions } from "vitepress-linkcard";
44
+
45
+ export default defineConfig({
46
+ // ...
47
+ markdown: {
48
+ config: (md) => {
49
+ md.use<LinkToCardPluginOptions>(linkToCardPlugin, {
50
+ // // Supported options:
51
+ // target: "_self",
52
+ // borderColor: "#039393",
53
+ // bgColor: "#CB3837"
54
+ });
55
+ },
56
+ }
57
+ // ...
58
+ });
59
+ ```
60
+
61
+ #### `*.md`
62
+
63
+ Generates a linkcard when `@:` appended.
64
+
65
+ ```md
66
+ [example](@:https://example.com)
67
+ ```
68
+
69
+ ## Supported options
70
+
71
+ ### borderColor
72
+
73
+ Specifies the border color of linkcards with a color code. For exmaple:
74
+
75
+ - `#7d7d7dff` (default)
76
+ - `rgba(3, 147, 147, 0.39)`
77
+ - ...
78
+
79
+ ### bgColor
80
+
81
+ Specifies the background color of linkcards with a color code. For exmaple:
82
+
83
+ - `#7d7d7d00` (default)
84
+ - `rgba(3, 147, 147, 0.39)`
85
+ - ...
86
+
87
+ ### target
88
+
89
+ Specifies the target window in which to open a link.
90
+
91
+ - `_blank` (default)
92
+ - `_self`
93
+ - `_top`
94
+ - `_parent`
95
+
96
+ ## Other specifications
97
+
98
+ ### `.linkcard_cache.json`
99
+
100
+ It is generated automatically in root dir and cache all the parsed metadata.
101
+
102
+ You can move it to `.config` directory or edit it if needed.
103
+
104
+ ### Special handling for `github.com`
105
+
106
+ When the domain is `github.com`, trimming is performed as shown in the following example to avoid duplication of the title and description.
107
+
108
+ | | Title | Description |
109
+ | - | - | - |
110
+ | Before | GitHub - asumo-1xts/vitepress-linkcard: A VitePress plugin to generate a pretty linkcard. | A VitePress plugin to generate a pretty linkcard. Contribute to asumo-1xts/vitepress-linkcard development by creating an account on GitHub. |
111
+ | After | asumo-1xts/vitepress-linkcard | A VitePress plugin to generate a pretty linkcard. |
Binary file
package/package.json CHANGED
@@ -40,7 +40,8 @@
40
40
  },
41
41
  "files": [
42
42
  "dist",
43
- "types"
43
+ "types",
44
+ "docs"
44
45
  ],
45
46
  "keywords": [
46
47
  "thumbnail",
@@ -60,7 +61,7 @@
60
61
  "publishConfig": {
61
62
  "registry": "https://registry.npmjs.org/"
62
63
  },
63
- "readme": "./.github/README.md",
64
+ "readme": "./docs/README.md",
64
65
  "repository": {
65
66
  "type": "git",
66
67
  "url": "git+https://github.com/asumo-1xts/vitepress-linkcard.git"
@@ -76,5 +77,5 @@
76
77
  },
77
78
  "type": "module",
78
79
  "types": "./types/index.d.ts",
79
- "version": "1.2.2"
80
+ "version": "1.2.4"
80
81
  }