@riebeckite/plugin-permalink 0.0.19 → 0.0.21
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 +41 -41
- package/README_ja.md +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -94,9 +94,9 @@ Without this plugin, Riebeckite still resolves every URL through the Core defaul
|
|
|
94
94
|
|
|
95
95
|
---
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
## Frontmatter
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
### ID
|
|
100
100
|
|
|
101
101
|
By default, the plugin reads the `id` field:
|
|
102
102
|
|
|
@@ -122,7 +122,7 @@ permalink-id: hello-world
|
|
|
122
122
|
|
|
123
123
|
`frontmatter` refers to a top-level frontmatter field.
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
### Permalink override
|
|
126
126
|
|
|
127
127
|
A specific entry can override its public URL entirely:
|
|
128
128
|
|
|
@@ -155,7 +155,7 @@ permalink({
|
|
|
155
155
|
});
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
### Redirects
|
|
159
159
|
|
|
160
160
|
Legacy URLs can be declared in frontmatter:
|
|
161
161
|
|
|
@@ -201,7 +201,7 @@ permalink({
|
|
|
201
201
|
|
|
202
202
|
---
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
## Options
|
|
205
205
|
|
|
206
206
|
| Option | Type | Default | Description |
|
|
207
207
|
| --- | --- | --- | --- |
|
|
@@ -220,9 +220,9 @@ permalink({
|
|
|
220
220
|
|
|
221
221
|
---
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
## ID strategies
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
### `frontmatter`
|
|
226
226
|
|
|
227
227
|
Uses the configured frontmatter field as the ID.
|
|
228
228
|
|
|
@@ -249,7 +249,7 @@ With `flat` mode, renaming or moving the source file does not change the ID or p
|
|
|
249
249
|
|
|
250
250
|
---
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
### `hash`
|
|
253
253
|
|
|
254
254
|
Ignores the frontmatter ID and derives the ID from the source file path.
|
|
255
255
|
|
|
@@ -292,7 +292,7 @@ Because the source path is the input, renaming or moving the file changes the ID
|
|
|
292
292
|
|
|
293
293
|
---
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
### `frontmatter-or-hash`
|
|
296
296
|
|
|
297
297
|
This is the default strategy.
|
|
298
298
|
|
|
@@ -321,7 +321,7 @@ This is useful for existing Obsidian vaults: content works without modification,
|
|
|
321
321
|
|
|
322
322
|
---
|
|
323
323
|
|
|
324
|
-
|
|
324
|
+
## ID metadata
|
|
325
325
|
|
|
326
326
|
The source of a resolved ID is exposed through metadata.
|
|
327
327
|
|
|
@@ -335,7 +335,7 @@ A manual `permalink` override changes the URL without removing identity. When th
|
|
|
335
335
|
|
|
336
336
|
---
|
|
337
337
|
|
|
338
|
-
|
|
338
|
+
## URL path modes
|
|
339
339
|
|
|
340
340
|
ID resolution and URL composition are separate concerns.
|
|
341
341
|
|
|
@@ -349,7 +349,7 @@ ID:
|
|
|
349
349
|
hello-world
|
|
350
350
|
```
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
### `flat`
|
|
353
353
|
|
|
354
354
|
```ts
|
|
355
355
|
path: {
|
|
@@ -370,7 +370,7 @@ This mode is useful for opaque, location-independent URLs.
|
|
|
370
370
|
|
|
371
371
|
---
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
### `preserve`
|
|
374
374
|
|
|
375
375
|
Preserves the source directory structure while placing the ID into the resulting URL.
|
|
376
376
|
|
|
@@ -393,7 +393,7 @@ notes/flutter/hello.md
|
|
|
393
393
|
|
|
394
394
|
---
|
|
395
395
|
|
|
396
|
-
|
|
396
|
+
### `append`
|
|
397
397
|
|
|
398
398
|
`append` is also available:
|
|
399
399
|
|
|
@@ -409,7 +409,7 @@ The mode exists separately so it can represent different composition semantics i
|
|
|
409
409
|
|
|
410
410
|
---
|
|
411
411
|
|
|
412
|
-
|
|
412
|
+
## Index files
|
|
413
413
|
|
|
414
414
|
`index.collapse` controls how `index.md` is represented.
|
|
415
415
|
|
|
@@ -437,13 +437,13 @@ with ID `hello-world`:
|
|
|
437
437
|
|
|
438
438
|
---
|
|
439
439
|
|
|
440
|
-
|
|
440
|
+
## Advanced: Custom resolvers
|
|
441
441
|
|
|
442
442
|
For URL schemes that cannot be expressed with the built-in strategies, `resolveId` and `resolvePath` provide escape hatches.
|
|
443
443
|
|
|
444
444
|
Prefer the built-in options when they are sufficient. Custom resolvers are intended for project-specific identity and URL schemes.
|
|
445
445
|
|
|
446
|
-
|
|
446
|
+
### `resolveId`
|
|
447
447
|
|
|
448
448
|
`resolveId` lets you compute the content ID yourself.
|
|
449
449
|
|
|
@@ -478,7 +478,7 @@ Values returned by `resolveId` still pass through the same ID validation as buil
|
|
|
478
478
|
|
|
479
479
|
A custom resolver therefore does not bypass the plugin's normal validation.
|
|
480
480
|
|
|
481
|
-
|
|
481
|
+
#### Example: derive an ID from custom frontmatter
|
|
482
482
|
|
|
483
483
|
Suppose your content uses:
|
|
484
484
|
|
|
@@ -525,7 +525,7 @@ Validation of project-specific frontmatter values inside a custom resolver is th
|
|
|
525
525
|
|
|
526
526
|
---
|
|
527
527
|
|
|
528
|
-
|
|
528
|
+
## Advanced: `resolvePath`
|
|
529
529
|
|
|
530
530
|
`resolvePath` gives full control over how a resolved ID becomes a public URL.
|
|
531
531
|
|
|
@@ -562,7 +562,7 @@ The result still passes through the plugin's normal URL normalization, validatio
|
|
|
562
562
|
|
|
563
563
|
---
|
|
564
564
|
|
|
565
|
-
|
|
565
|
+
## Combining `resolveId` and `resolvePath`
|
|
566
566
|
|
|
567
567
|
Both resolvers can be used together when both identity and URL structure are project-specific.
|
|
568
568
|
|
|
@@ -611,7 +611,7 @@ Riebeckite still treats only the final resolved URL as the canonical public loca
|
|
|
611
611
|
|
|
612
612
|
---
|
|
613
613
|
|
|
614
|
-
|
|
614
|
+
## Choosing between built-in and custom resolution
|
|
615
615
|
|
|
616
616
|
A useful rule is:
|
|
617
617
|
|
|
@@ -652,7 +652,7 @@ This is preferable because the intent is clearer and the configuration remains d
|
|
|
652
652
|
|
|
653
653
|
---
|
|
654
654
|
|
|
655
|
-
|
|
655
|
+
## Guarantees with custom resolvers
|
|
656
656
|
|
|
657
657
|
Using a custom resolver does not bypass the rest of the Permalink Plugin pipeline.
|
|
658
658
|
|
|
@@ -671,7 +671,7 @@ Custom resolvers change how the ID or path is produced, not how the resulting pu
|
|
|
671
671
|
|
|
672
672
|
---
|
|
673
673
|
|
|
674
|
-
|
|
674
|
+
## Manual permalink precedence
|
|
675
675
|
|
|
676
676
|
A manual permalink override takes precedence over normal ID and path resolution.
|
|
677
677
|
|
|
@@ -700,7 +700,7 @@ This makes it possible to use a general URL strategy while giving a few special
|
|
|
700
700
|
|
|
701
701
|
---
|
|
702
702
|
|
|
703
|
-
|
|
703
|
+
## Stateless builds
|
|
704
704
|
|
|
705
705
|
The Permalink Plugin does not maintain a persistent ID registry.
|
|
706
706
|
|
|
@@ -729,7 +729,7 @@ Use explicit frontmatter IDs for content whose URL must survive source-file move
|
|
|
729
729
|
|
|
730
730
|
---
|
|
731
731
|
|
|
732
|
-
|
|
732
|
+
## Rename and move behavior
|
|
733
733
|
|
|
734
734
|
URL stability depends on both the ID strategy and path mode.
|
|
735
735
|
|
|
@@ -770,9 +770,9 @@ is usually more convenient.
|
|
|
770
770
|
|
|
771
771
|
---
|
|
772
772
|
|
|
773
|
-
|
|
773
|
+
## Validation
|
|
774
774
|
|
|
775
|
-
|
|
775
|
+
### IDs
|
|
776
776
|
|
|
777
777
|
An ID must represent a single URL path segment.
|
|
778
778
|
|
|
@@ -787,7 +787,7 @@ The following are rejected:
|
|
|
787
787
|
|
|
788
788
|
Values returned by `resolveId` are subject to the same rules.
|
|
789
789
|
|
|
790
|
-
|
|
790
|
+
### Permalinks
|
|
791
791
|
|
|
792
792
|
Permalinks and redirects must be site-local absolute paths.
|
|
793
793
|
|
|
@@ -804,7 +804,7 @@ Values returned by `resolvePath` are subject to the same rules.
|
|
|
804
804
|
|
|
805
805
|
---
|
|
806
806
|
|
|
807
|
-
|
|
807
|
+
## Collision detection
|
|
808
808
|
|
|
809
809
|
The plugin detects conflicting public locations during the build.
|
|
810
810
|
|
|
@@ -843,7 +843,7 @@ This prevents public URLs from changing based on build or content ordering.
|
|
|
843
843
|
|
|
844
844
|
---
|
|
845
845
|
|
|
846
|
-
|
|
846
|
+
## Inspecting resolved URLs
|
|
847
847
|
|
|
848
848
|
Resolved values can be inspected through Riebeckite's existing content inspection command:
|
|
849
849
|
|
|
@@ -865,16 +865,16 @@ The exact output format may vary between CLI versions.
|
|
|
865
865
|
|
|
866
866
|
---
|
|
867
867
|
|
|
868
|
-
|
|
868
|
+
## Exports
|
|
869
869
|
|
|
870
|
-
|
|
870
|
+
### Functions
|
|
871
871
|
|
|
872
872
|
- `permalink(options?)`
|
|
873
873
|
- `permalinkPlugin(options?)`
|
|
874
874
|
|
|
875
875
|
Both create the Permalink Plugin.
|
|
876
876
|
|
|
877
|
-
|
|
877
|
+
### Types
|
|
878
878
|
|
|
879
879
|
- `PermalinkOptions`
|
|
880
880
|
- `PermalinkIdStrategy`
|
|
@@ -885,9 +885,9 @@ Use the exported types when building type-safe project-specific resolver configu
|
|
|
885
885
|
|
|
886
886
|
---
|
|
887
887
|
|
|
888
|
-
|
|
888
|
+
## Configuration examples
|
|
889
889
|
|
|
890
|
-
|
|
890
|
+
### Existing Obsidian vault
|
|
891
891
|
|
|
892
892
|
Hide the filesystem layout without requiring frontmatter changes across the vault:
|
|
893
893
|
|
|
@@ -907,7 +907,7 @@ permalink({
|
|
|
907
907
|
});
|
|
908
908
|
```
|
|
909
909
|
|
|
910
|
-
|
|
910
|
+
### Explicit permanent IDs
|
|
911
911
|
|
|
912
912
|
Require every entry to define its identity explicitly:
|
|
913
913
|
|
|
@@ -926,7 +926,7 @@ permalink({
|
|
|
926
926
|
});
|
|
927
927
|
```
|
|
928
928
|
|
|
929
|
-
|
|
929
|
+
### Preserve directory structure
|
|
930
930
|
|
|
931
931
|
```ts
|
|
932
932
|
permalink({
|
|
@@ -941,7 +941,7 @@ permalink({
|
|
|
941
941
|
});
|
|
942
942
|
```
|
|
943
943
|
|
|
944
|
-
|
|
944
|
+
### Fully custom URL scheme
|
|
945
945
|
|
|
946
946
|
```ts
|
|
947
947
|
permalink({
|
|
@@ -959,8 +959,8 @@ permalink({
|
|
|
959
959
|
|
|
960
960
|
---
|
|
961
961
|
|
|
962
|
-
|
|
962
|
+
## See also
|
|
963
963
|
|
|
964
|
-
- [Plugin guide](../../../docs/docs/reference/plugin-api.
|
|
965
|
-
- [Content system](../../../docs/docs/framework/content-system.
|
|
964
|
+
- [Plugin guide](../../../docs/docs/reference/plugin-api.md)
|
|
965
|
+
- [Content system](../../../docs/docs/framework/content-system.md)
|
|
966
966
|
|
package/README_ja.md
CHANGED
|
@@ -977,6 +977,6 @@ permalink({
|
|
|
977
977
|
|
|
978
978
|
## 関連資料
|
|
979
979
|
|
|
980
|
-
- [プラグインシステム](../../../docs/docs/reference/plugin-api.md)
|
|
981
|
-
- [コンテンツシステム](../../../docs/docs/framework/content-system.md)
|
|
980
|
+
- [プラグインシステム](../../../docs/docs/reference/plugin-api.ja.md)
|
|
981
|
+
- [コンテンツシステム](../../../docs/docs/framework/content-system.ja.md)
|
|
982
982
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-permalink",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"yaml": "^2.9.0",
|
|
18
|
-
"@riebeckite/core": "0.0.
|
|
18
|
+
"@riebeckite/core": "0.0.21"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tsx": "^4.22.4",
|
|
22
|
-
"@riebeckite/test": "0.0.
|
|
22
|
+
"@riebeckite/test": "0.0.21"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|