Commit ae7d8a3
v1.3.0: emit tropy_url deep link recovered from Tropy's Redux store
Each exported file now gets a `tropy_url:` field in its frontmatter,
pointing back to the source item in Tropy:
tropy_url: "tropy://project/current/items/14410/14411"
Clicking the URL from a Markdown editor opens Tropy to that item with
its cover photo selected — the canonical way to review a transcription
against the original scan without leaving the analytical layer.
The challenge is that Tropy's JSON-LD export payload contains no
internal item IDs. The plugin recovers them by reading `state.items`
and `state.photos` from Tropy's Redux store (via
`this.context.window.store.getState()`) and building a
Map<photoPath, itemId> at the start of each export. Each JSON-LD item is
then matched to its store record by its first photo's path (more
reliable than checksum, which Tropy occasionally ships as
md5-of-empty-string for unprocessed photos). Once matched, the URL is
built from the item ID and either `cover_image_id` (rare) or the first
photo ID (typical), matching the behavior of the original Python
export script.
Graceful degradation: if the store isn't accessible (e.g. an older
Tropy version with a different shape), the lookup returns null and the
`tropy_url:` field is simply omitted. Nothing else in the export is
affected.
The field is renamable via the fieldRename setting, like any other
top-level YAML key. README updated with a "Tropy deep links" section
explaining the behavior and a sample tropy_url entry in the output-
shape example.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent df503ed commit ae7d8a3
3 files changed
Lines changed: 83 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| |||
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
284 | 299 | | |
285 | 300 | | |
286 | 301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
333 | 376 | | |
334 | 377 | | |
335 | 378 | | |
| |||
434 | 477 | | |
435 | 478 | | |
436 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
437 | 486 | | |
438 | 487 | | |
439 | 488 | | |
| |||
626 | 675 | | |
627 | 676 | | |
628 | 677 | | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
634 | 686 | | |
635 | | - | |
| 687 | + | |
636 | 688 | | |
637 | 689 | | |
638 | | - | |
639 | 690 | | |
640 | | - | |
| 691 | + | |
641 | 692 | | |
| 693 | + | |
| 694 | + | |
642 | 695 | | |
643 | 696 | | |
644 | 697 | | |
| |||
650 | 703 | | |
651 | 704 | | |
652 | 705 | | |
653 | | - | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
654 | 709 | | |
655 | 710 | | |
656 | 711 | | |
| |||
769 | 824 | | |
770 | 825 | | |
771 | 826 | | |
| 827 | + | |
| 828 | + | |
772 | 829 | | |
773 | 830 | | |
774 | 831 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
0 commit comments