@riebeckite/plugin-attachment 0.0.11 → 0.0.13
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 +71 -71
- package/README_ja.md +47 -47
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
# @riebeckite/plugin-attachment
|
|
2
|
-
|
|
3
|
-
Attachment link and embed card rendering for Obsidian wikilinks.
|
|
4
|
-
|
|
5
|
-
[日本語](./README_ja.md)
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
`attachment()` provides the `renderAttachment` hook that
|
|
10
|
-
`@riebeckite/plugin-obsidian-markdown` uses when a wikilink resolves to a
|
|
11
|
-
non-image file (`[[report.pdf]]`, `![[report.pdf]]`, ...).
|
|
12
|
-
|
|
13
|
-
Without this plugin, those wikilinks fall back to a plain download link.
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import { defineConfig } from "@riebeckite/core";
|
|
19
|
-
import { attachment } from "@riebeckite/plugin-attachment";
|
|
20
|
-
import { obsidianMarkdown } from "@riebeckite/plugin-obsidian-markdown";
|
|
21
|
-
|
|
22
|
-
export default defineConfig({
|
|
23
|
-
// ...
|
|
24
|
-
plugins: [obsidianMarkdown(), attachment()],
|
|
25
|
-
});
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Rendering
|
|
29
|
-
|
|
30
|
-
### Link (non-embed)
|
|
31
|
-
|
|
32
|
-
```html
|
|
33
|
-
<a class="wikilink wikilink-attachment" href="..." download>label</a>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Embed (`![[file]]`)
|
|
37
|
-
|
|
38
|
-
```html
|
|
39
|
-
<aside class="attachment-card rr-attachment" data-attachment-path="...">
|
|
40
|
-
<div class="attachment-card__meta">
|
|
41
|
-
<span class="attachment-card__format">PDF</span>
|
|
42
|
-
<span class="attachment-card__size">1.2 MB</span>
|
|
43
|
-
</div>
|
|
44
|
-
<div class="attachment-card__name">report.pdf</div>
|
|
45
|
-
<a class="attachment-card__download" href="..." download>label</a>
|
|
46
|
-
</aside>
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
- Format is the uppercased file extension
|
|
50
|
-
- Size is read from disk under `config.content.directory` (path-traversal
|
|
51
|
-
safe) and omitted when the file cannot be read
|
|
52
|
-
- The embed card carries the stable `rr-attachment` root hook that themes
|
|
53
|
-
may target
|
|
54
|
-
|
|
55
|
-
Styles ship in `style.css` (inline attachment links also get a `↓` suffix).
|
|
56
|
-
|
|
57
|
-
## Options
|
|
58
|
-
|
|
59
|
-
| Option | Type | Default | Description |
|
|
60
|
-
| ------ | ---- | ------- | ----------- |
|
|
61
|
-
| `showSize` | `boolean` | `true` | Read the file size and show it in the embed card |
|
|
62
|
-
|
|
63
|
-
## Exports
|
|
64
|
-
|
|
65
|
-
- `attachment(options?)` / `attachmentPlugin` — plugin factory
|
|
66
|
-
- Type: `AttachmentOptions`
|
|
67
|
-
|
|
68
|
-
## See also
|
|
69
|
-
|
|
70
|
-
- [Plugin guide](../../../docs/en/plugin-
|
|
71
|
-
- [`@riebeckite/plugin-obsidian-markdown`](../obsidian-markdown/README.md)
|
|
1
|
+
# @riebeckite/plugin-attachment
|
|
2
|
+
|
|
3
|
+
Attachment link and embed card rendering for Obsidian wikilinks.
|
|
4
|
+
|
|
5
|
+
[日本語](./README_ja.md)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
`attachment()` provides the `renderAttachment` hook that
|
|
10
|
+
`@riebeckite/plugin-obsidian-markdown` uses when a wikilink resolves to a
|
|
11
|
+
non-image file (`[[report.pdf]]`, `![[report.pdf]]`, ...).
|
|
12
|
+
|
|
13
|
+
Without this plugin, those wikilinks fall back to a plain download link.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { defineConfig } from "@riebeckite/core";
|
|
19
|
+
import { attachment } from "@riebeckite/plugin-attachment";
|
|
20
|
+
import { obsidianMarkdown } from "@riebeckite/plugin-obsidian-markdown";
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
// ...
|
|
24
|
+
plugins: [obsidianMarkdown(), attachment()],
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Rendering
|
|
29
|
+
|
|
30
|
+
### Link (non-embed)
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<a class="wikilink wikilink-attachment" href="..." download>label</a>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Embed (`![[file]]`)
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<aside class="attachment-card rr-attachment" data-attachment-path="...">
|
|
40
|
+
<div class="attachment-card__meta">
|
|
41
|
+
<span class="attachment-card__format">PDF</span>
|
|
42
|
+
<span class="attachment-card__size">1.2 MB</span>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="attachment-card__name">report.pdf</div>
|
|
45
|
+
<a class="attachment-card__download" href="..." download>label</a>
|
|
46
|
+
</aside>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- Format is the uppercased file extension
|
|
50
|
+
- Size is read from disk under `config.content.directory` (path-traversal
|
|
51
|
+
safe) and omitted when the file cannot be read
|
|
52
|
+
- The embed card carries the stable `rr-attachment` root hook that themes
|
|
53
|
+
may target
|
|
54
|
+
|
|
55
|
+
Styles ship in `style.css` (inline attachment links also get a `↓` suffix).
|
|
56
|
+
|
|
57
|
+
## Options
|
|
58
|
+
|
|
59
|
+
| Option | Type | Default | Description |
|
|
60
|
+
| ------ | ---- | ------- | ----------- |
|
|
61
|
+
| `showSize` | `boolean` | `true` | Read the file size and show it in the embed card |
|
|
62
|
+
|
|
63
|
+
## Exports
|
|
64
|
+
|
|
65
|
+
- `attachment(options?)` / `attachmentPlugin` — plugin factory
|
|
66
|
+
- Type: `AttachmentOptions`
|
|
67
|
+
|
|
68
|
+
## See also
|
|
69
|
+
|
|
70
|
+
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
|
71
|
+
- [`@riebeckite/plugin-obsidian-markdown`](../obsidian-markdown/README.md)
|
package/README_ja.md
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
# @riebeckite/plugin-attachment
|
|
2
|
-
|
|
3
|
-
Obsidian 形式の添付ファイルリンクを、ダウンロードリンクや添付カードとして表示するプラグインです。
|
|
4
|
-
|
|
5
|
-
[English](./README.md)
|
|
6
|
-
|
|
7
|
-
## まず何を解決するか
|
|
8
|
-
|
|
9
|
-
`[[report.pdf]]` や `![[report.pdf]]` のような画像以外のウィキリンクを扱います。`@riebeckite/plugin-obsidian-markdown` がリンク先を添付ファイルとして解決したとき、このプラグインが表示を引き受けます。未登録でも通常のダウンロードリンクにはなりますが、埋め込み用のカードは作られません。
|
|
10
|
-
|
|
11
|
-
## 設定
|
|
12
|
-
|
|
13
|
-
Obsidian Markdown プラグインとともに登録します。
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { defineConfig } from "@riebeckite/core";
|
|
17
|
-
import { attachment } from "@riebeckite/plugin-attachment";
|
|
18
|
-
import { obsidianMarkdown } from "@riebeckite/plugin-obsidian-markdown";
|
|
19
|
-
|
|
20
|
-
export default defineConfig({
|
|
21
|
-
// ...
|
|
22
|
-
plugins: [obsidianMarkdown(), attachment()],
|
|
23
|
-
});
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## リンクと埋め込みで表示を分ける
|
|
27
|
-
|
|
28
|
-
- `[[report.pdf]]` は、`download` 属性を持つ通常のリンクになります。
|
|
29
|
-
- `![[report.pdf]]` は、拡張子、ファイル名、ダウンロードリンクを含む添付カードになります。
|
|
30
|
-
|
|
31
|
-
カードのファイルサイズは `config.content.directory` 配下から読み取ります。パスはコンテンツディレクトリの外へ出られないよう検査され、読めないファイルのサイズは表示しません。
|
|
32
|
-
|
|
33
|
-
## オプション
|
|
34
|
-
|
|
35
|
-
| オプション | 型 | 既定値 | 内容 |
|
|
36
|
-
| --- | --- | --- | --- |
|
|
37
|
-
| `showSize` | `boolean` | `true` | 埋め込みカードにファイルサイズを表示するか |
|
|
38
|
-
|
|
39
|
-
## 公開 API
|
|
40
|
-
|
|
41
|
-
- `attachment(options?)` / `attachmentPlugin` — プラグインファクトリ
|
|
42
|
-
- `AttachmentOptions` — オプションの型
|
|
43
|
-
|
|
44
|
-
## 関連資料
|
|
45
|
-
|
|
46
|
-
- [プラグインシステム](../../../docs/ja/plugin-
|
|
47
|
-
- [`@riebeckite/plugin-obsidian-markdown`](../obsidian-markdown/README_ja.md)
|
|
1
|
+
# @riebeckite/plugin-attachment
|
|
2
|
+
|
|
3
|
+
Obsidian 形式の添付ファイルリンクを、ダウンロードリンクや添付カードとして表示するプラグインです。
|
|
4
|
+
|
|
5
|
+
[English](./README.md)
|
|
6
|
+
|
|
7
|
+
## まず何を解決するか
|
|
8
|
+
|
|
9
|
+
`[[report.pdf]]` や `![[report.pdf]]` のような画像以外のウィキリンクを扱います。`@riebeckite/plugin-obsidian-markdown` がリンク先を添付ファイルとして解決したとき、このプラグインが表示を引き受けます。未登録でも通常のダウンロードリンクにはなりますが、埋め込み用のカードは作られません。
|
|
10
|
+
|
|
11
|
+
## 設定
|
|
12
|
+
|
|
13
|
+
Obsidian Markdown プラグインとともに登録します。
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { defineConfig } from "@riebeckite/core";
|
|
17
|
+
import { attachment } from "@riebeckite/plugin-attachment";
|
|
18
|
+
import { obsidianMarkdown } from "@riebeckite/plugin-obsidian-markdown";
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
// ...
|
|
22
|
+
plugins: [obsidianMarkdown(), attachment()],
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## リンクと埋め込みで表示を分ける
|
|
27
|
+
|
|
28
|
+
- `[[report.pdf]]` は、`download` 属性を持つ通常のリンクになります。
|
|
29
|
+
- `![[report.pdf]]` は、拡張子、ファイル名、ダウンロードリンクを含む添付カードになります。
|
|
30
|
+
|
|
31
|
+
カードのファイルサイズは `config.content.directory` 配下から読み取ります。パスはコンテンツディレクトリの外へ出られないよう検査され、読めないファイルのサイズは表示しません。
|
|
32
|
+
|
|
33
|
+
## オプション
|
|
34
|
+
|
|
35
|
+
| オプション | 型 | 既定値 | 内容 |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| `showSize` | `boolean` | `true` | 埋め込みカードにファイルサイズを表示するか |
|
|
38
|
+
|
|
39
|
+
## 公開 API
|
|
40
|
+
|
|
41
|
+
- `attachment(options?)` / `attachmentPlugin` — プラグインファクトリ
|
|
42
|
+
- `AttachmentOptions` — オプションの型
|
|
43
|
+
|
|
44
|
+
## 関連資料
|
|
45
|
+
|
|
46
|
+
- [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
|
|
47
|
+
- [`@riebeckite/plugin-obsidian-markdown`](../obsidian-markdown/README_ja.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-attachment",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"./style.css": "./style.css"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@riebeckite/core": "0.0.
|
|
18
|
+
"@riebeckite/core": "0.0.13"
|
|
19
19
|
},
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|