literate-diff-viewer (DEMO)
Show source code description with literate diff way. Literate diff is a source code description method influenced by Literate programming and Literate commits.
- Use for multiple source code files on your web server.
- Use for a committed source code file on GitHub.
type SrcType = "show" | "hide" | "silent";
type SourceChangeEvent = {
oldFileName: string;
currentFileName: string;
type: SrcType;
};
type Options = {
readmeFileName?: string; // default: "./README.md"
srcDirectoryName?: string; // default: "./src/"
isFetchingFromOtherHost?: boolean; // default: false
onSourceChange?: (event: SourceChangeEvent) => void;
postProcessSource?: (src: string) => string;
storageKeyName?: string;
};
type SourceFileNameElement = {
element: HTMLElement;
fileName: string;
srcText: string;
type: SrcType;
};
async function init(_options: Options = {}): Promise<{
markdownDiv: HTMLDivElement;
sourceFileNameElements: SourceFileNameElement[];
}>;
function start();