async function parseTitle(filename, rootdir) {
	if (!filename.endsWith(".md")) {
		return [];
	}
	const contents = (await fs.readFile(filename)).toString();
	const match = contents.match(title_regex);
	if (match == null) {
		console.log("Could not find title in " + filename);
	}
	const relativeFilename = filename.slice(rootdir.length).replace(/\\/g, '/');
	return `"${mapTitle(match[1], relativeFilename)}" = "${relativeFilename}"`;
}
/// Parse the title from a file and return an array containing the title and the filename relative to the root directory.
Parse the title from a file and return an array containing the title and the filename relative to the root directory.
Parse the title from a file and return an array containing the title and the filename relative to the root directory .
async function parseTitle(filename, rootdir) {
	if (!filename.endsWith(".md")) {
		return [];
	}
	const contents = (await fs.readFile(filename)).toString();
	const match = contents.match(title_regex);
	if (match == null) {
		console.log("Could not find title in " + filename);
	}
	const relativeFilename = filename.slice(rootdir.length).replace(/\\/g, '/');
	return `"${mapTitle(match[1], relativeFilename)}" = "${relativeFilename}"`;
}
async function parseTitle ( filename , rootdir ) { if ( ! filename . endsWith ( ".md" ) ) { return [ ] ; } const contents = ( await fs . readFile ( filename ) ) . toString ( ) ; const match = contents . match ( title_regex ) ; if ( match == null ) { console . log ( "Could not find title in " + filename ) ; } const relativeFilename = filename . slice ( rootdir . length ) . replace ( / \\ / g , '/' ) ; return ` ${ mapTitle ( match [ 1 ] , relativeFilename ) } ${ relativeFilename } ` ; }
Parse the title from a file and return an array containing the title and the filename relative to the root directory.
Parse the title from a file and return an array containing the title and the filename relative to the root directory .