uniorg-attach
Version:
Uniorg plugin to process org-attach attachment links
49 lines (48 loc) • 1.74 kB
TypeScript
import type { Plugin } from 'unified';
export interface Options {
/**
* The directory where attachments are stored. If this is a relative
* path, it will be interpreted relative to the directory where the
* Org file lives.
*
* Corresponds to `org-attach-id-dir` in Emacs.
*/
idDir: string;
/**
* Attachment inheritance for the outline.
*
* Enabling inheritance for implies that attachment links will look
* through all parent headings until it finds the linked attachment.
*
* Corresponds to `org-attach-use-inheritance` in Emacs.
*/
useInheritance: boolean;
/**
* A function parsing an ID string into a folder-path.
*
* Similar to `org-attach-id-to-path-function-list` in Emacs, but
* only allows one function.
*
* This module exports `idUuidFolderFormat` and `idTsFolderFormat`
* that re-implement two common behaviors for org-attach.
*/
idToPath: (id: string) => string;
}
/**
* Translate an UUID ID into a folder-path. Default format for how Org
* translates ID properties to a path for attachments. Useful if ID is
* generated with UUID.
*
* Corresponds to `org-attach-id-uuid-folder-format` in Emacs.
*/
export declare function idUuidFolderFormat(id: string): string;
/**
* Translate an ID based on a timestamp to a folder-path. Useful way
* of translation if ID is generated based on ISO8601 timestamp.
* Splits the attachment folder hierarchy into year-month, the rest.
*
* Corresponds to `org-attach-id-ts-folder-format` in Emacs.
*/
export declare function idTsFolderFormat(id: string): string;
export declare const uniorgAttach: Plugin<[Partial<Options>?]>;
export default uniorgAttach;