@riebeckite/plugin-attachment 0.0.27 → 0.0.29
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 +5 -5
- package/README_ja.md +8 -8
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/style.css +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Attachment link and embed card rendering for Obsidian wikilinks.
|
|
|
10
10
|
|
|
11
11
|
`attachment()` provides the `renderAttachment` hook that
|
|
12
12
|
`@riebeckite/plugin-obsidian-markdown` uses when a wikilink resolves to a
|
|
13
|
-
non-image file (`[
|
|
13
|
+
non-image file (`[report.pdf](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/report.pdf.md)`, ``, ...).
|
|
14
14
|
|
|
15
15
|
Without this plugin, those wikilinks fall back to a plain download link.
|
|
16
16
|
|
|
@@ -41,15 +41,15 @@ The following source is rendered on this page. A plain wikilink becomes a downlo
|
|
|
41
41
|
|
|
42
42
|
#### Rendered
|
|
43
43
|
|
|
44
|
-
[
|
|
44
|
+
[attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/attachment-example.txt.md)
|
|
45
45
|
|
|
46
|
-

|
|
47
47
|
|
|
48
48
|
- Format is the uppercased file extension.
|
|
49
49
|
- Size is read from disk under `config.content.directory` (path-traversal safe)
|
|
50
50
|
and omitted when the file cannot be read.
|
|
51
|
-
- The embed card carries the stable `rr-attachment` root hook
|
|
52
|
-
|
|
51
|
+
- The embed card carries the stable `rr-attachment` root hook, and inline
|
|
52
|
+
attachment links use `rr-attachment-link`.
|
|
53
53
|
|
|
54
54
|
Styles ship in `style.css` (inline attachment links also get a `↓` suffix).
|
|
55
55
|
|
package/README_ja.md
CHANGED
|
@@ -8,7 +8,7 @@ Obsidian 形式の添付ファイルリンクを、ダウンロードリンク
|
|
|
8
8
|
|
|
9
9
|
## まず何を解決するか
|
|
10
10
|
|
|
11
|
-
`[
|
|
11
|
+
`[report.pdf](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/report.pdf.ja.md)` や `` のような画像以外のウィキリンクを扱います。`@riebeckite/plugin-obsidian-markdown` がリンク先を添付ファイルとして解決したとき、このプラグインが表示を引き受けます。未登録でも通常のダウンロードリンクにはなりますが、埋め込み用のカードは作られません。
|
|
12
12
|
|
|
13
13
|
## 設定
|
|
14
14
|
|
|
@@ -27,8 +27,8 @@ export default defineConfig({
|
|
|
27
27
|
|
|
28
28
|
## リンクと埋め込みで表示を分ける
|
|
29
29
|
|
|
30
|
-
- `[
|
|
31
|
-
- `` は、`download` 属性を持つ通常のリンクになります。
|
|
31
|
+
- `` は、拡張子、ファイル名、ダウンロードリンクを含む添付カードになります。
|
|
32
32
|
|
|
33
33
|
以下のソースは、このページ上で実際に描画されます。
|
|
34
34
|
|
|
@@ -42,14 +42,14 @@ export default defineConfig({
|
|
|
42
42
|
|
|
43
43
|
#### 実行例
|
|
44
44
|
|
|
45
|
-
[
|
|
45
|
+
[attachment-example.txt](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/attachment-example.txt.ja.md)
|
|
46
46
|
|
|
47
|
-

|
|
48
48
|
|
|
49
49
|
- 形式は大文字にした拡張子です。
|
|
50
50
|
- カードのファイルサイズは `config.content.directory` 配下から読み取ります。パスは
|
|
51
51
|
コンテンツディレクトリの外へ出られないよう検査され、読めないファイルのサイズは表示しません。
|
|
52
|
-
-
|
|
52
|
+
- 埋め込みカードには Theme が対象にできる安定した `rr-attachment` ルート Hook が付き、インライン添付リンクには `rr-attachment-link` を使用します。
|
|
53
53
|
|
|
54
54
|
スタイルは `style.css` に同梱されます(インラインの添付リンクには `↓` 接尾辞も付きます)。
|
|
55
55
|
|
|
@@ -61,8 +61,8 @@ export default defineConfig({
|
|
|
61
61
|
|
|
62
62
|
## 公開 API
|
|
63
63
|
|
|
64
|
-
- `attachment(options?)` / `attachmentPlugin
|
|
65
|
-
- `AttachmentOptions
|
|
64
|
+
- `attachment(options?)` / `attachmentPlugin`:プラグインファクトリ
|
|
65
|
+
- `AttachmentOptions`:オプションの型
|
|
66
66
|
|
|
67
67
|
## 関連資料
|
|
68
68
|
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ function attachment(options = {}) {
|
|
|
11
11
|
return definePlugin({
|
|
12
12
|
name: PLUGIN_NAME,
|
|
13
13
|
processedContentCache: {
|
|
14
|
-
version: "attachment-
|
|
14
|
+
version: "attachment-v3",
|
|
15
15
|
dependencyMode: "tracked"
|
|
16
16
|
},
|
|
17
17
|
options,
|
|
@@ -37,7 +37,7 @@ async function renderAttachment(context, options) {
|
|
|
37
37
|
const extension = getExtension(context.path).toUpperCase() || "FILE";
|
|
38
38
|
const size = options.showSize === false ? null : await getAttachmentSize(context);
|
|
39
39
|
if (!context.embed) {
|
|
40
|
-
return `<a class="
|
|
40
|
+
return `<a class="rr-attachment-link" href="${escapeHtmlAttribute(context.url)}" download>${escapeHtml(context.label || fileName)}</a>`;
|
|
41
41
|
}
|
|
42
42
|
const sizeHtml = size ? `<span class="rr-attachment__size">${escapeHtml(size)}</span>` : "";
|
|
43
43
|
return `<aside class="rr-attachment" data-attachment-path="${escapeHtmlAttribute(context.path)}">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-attachment",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
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.29"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tsx": "^4.22.4"
|