Skip to content

Show source code description with literate diff way

License

Notifications You must be signed in to change notification settings

abagames/literate-diff-viewer

Repository files navigation

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.

screenshot

How to use literate-diff-viewer

Reference

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();

About

Show source code description with literate diff way

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published