@thi.ng/tangle
Version:
Literate programming code block tangling / codegen utility, inspired by org-mode & noweb
30 lines • 1.27 kB
TypeScript
import type { IObjectOf } from "@thi.ng/api";
import { type TangleCtx } from "./api.js";
/**
* Takes a file `path` and partial {@link TangleCtx}. Reads "file"
* (implementation specific, could be from memory or other source) and then
* performs all tangling steps on the document body, i.e. expanding &
* transcluding code blocks, generating outputs for various target files etc.
* Returns updated TangleCtx with all generated outputs stored under the
* {@link TangleCtx.outputs} key.
*
* @param path
* @param ctx
*/
export declare const tangleFile: (path: string, ctx?: Partial<TangleCtx>) => TangleCtx;
/**
* In-memory version of {@link tangleFile}. Take a file name and an object of
* file names and their respective contents, then calls {@link tangleFile} with
* a customized {@link TangleCtx} which resolves code block refs using given
* virtual "file system" (of sorts).
*
* @remarks
* Relative file reference paths are only supported if they refer to children or
* siblings, i.e. `foo/bar.md` is okay, but `../foo/bar.md` is NOT supported.
*
* @param fileID
* @param files
* @param ctx
*/
export declare const tangleString: (fileID: string, files: IObjectOf<string>, ctx?: Partial<TangleCtx>) => TangleCtx;
//# sourceMappingURL=tangle.d.ts.map