@canalplus/readme.doc
Version:
Readme's an Extremely Accessible Documentation MakEr
60 lines (59 loc) • 2.42 kB
TypeScript
import type { FileSearchIndex } from "./get_search_data_for_content.js";
/** Input data required to produce a single documentation page. */
export interface DocumentationPageSettings {
/** Absolute path to the root dir where all outputed files will be */
baseOutDir: string;
/** Relative CSS URLs on this page */
cssUrls: string[];
/** Eventual URL to the favicon */
faviconUrl: string | null;
/** Absolute path to the file that should be converted */
inputFile: string;
/** Function translating links in Markdown files to an URL form to the right file */
linkTranslator: (link: string) => string | undefined;
/** HTML string for the navbar (the header on the top of the page) */
navBarHtml: string;
/** Information relative to the next documentation page, `null` if none. */
nextPageInfo: {
/** Relative URL linking to it. */
link: string;
/** Display Name for the page. */
name: string;
} | null;
/** Absolute path where the generated page should be generated. */
outputFile: string;
/** HTML string for the complete list of documentation pages with links */
pageListHtml: string;
/** Title of the corresponding HTML page */
pageTitle: string;
/** Information relative to the previous documentation page, `null` if none. */
prevPageInfo: {
/** Relative URL linking to it. */
link: string;
/** Display Name for the page. */
name: string;
} | null;
/** Relative JS URLs on this page */
scriptUrls: string[];
/**
* Array corresponding to the complete search index.
* It will be completed with data present in this file.
*/
searchIndex: Array<{
file: string;
index: FileSearchIndex[];
}>;
/** HTML string for the sidebar */
sidebarHtml: string;
}
interface DocumentationPageMetadata {
/** All "anchors" present in the generated page. */
anchors: string[];
}
/**
* Create and write HTML page output file from the markdown input file.
* @param {Object} options
* @returns {Promise}
*/
export default function createDocumentationPage({ baseOutDir, cssUrls, faviconUrl, inputFile, linkTranslator, navBarHtml, nextPageInfo, outputFile, pageListHtml, pageTitle, prevPageInfo, scriptUrls, searchIndex, sidebarHtml, }: DocumentationPageSettings): Promise<DocumentationPageMetadata>;
export {};