vitepress-linkcard 1.2.3 → 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 +1 -1
- package/dist/.esm.min.js +1 -1
- package/docs/CONTRIBUTING.md +41 -0
- package/docs/README.md +111 -0
- package/docs/screen.webp +0 -0
- package/package.json +3 -3
package/dist/.cjs.min.js
CHANGED
package/dist/.esm.min.js
CHANGED
|
@@ -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
|
+
[](https://www.npmjs.com/package/vitepress-linkcard)
|
|
12
|
+
[](https://www.npmjs.com/package/vitepress-linkcard)
|
|
13
|
+
[](/LICENSE)
|
|
14
|
+
|
|
15
|
+
[](https://vuejs.github.io/vitepress/v1/)
|
|
16
|
+
[](https://yarnpkg.com/)
|
|
17
|
+
[](https://github.com/asumo-1xts/vitepress-linkcard/actions/workflows/eslint.yml)
|
|
18
|
+
[](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. |
|
package/docs/screen.webp
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"files": [
|
|
42
42
|
"dist",
|
|
43
43
|
"types",
|
|
44
|
-
"
|
|
44
|
+
"docs"
|
|
45
45
|
],
|
|
46
46
|
"keywords": [
|
|
47
47
|
"thumbnail",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"registry": "https://registry.npmjs.org/"
|
|
63
63
|
},
|
|
64
|
-
"readme": "
|
|
64
|
+
"readme": "./docs/README.md",
|
|
65
65
|
"repository": {
|
|
66
66
|
"type": "git",
|
|
67
67
|
"url": "git+https://github.com/asumo-1xts/vitepress-linkcard.git"
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
},
|
|
78
78
|
"type": "module",
|
|
79
79
|
"types": "./types/index.d.ts",
|
|
80
|
-
"version": "1.2.
|
|
80
|
+
"version": "1.2.4"
|
|
81
81
|
}
|