mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 17:23:05 -05:00
Add documentation and fix paths (#14948)
* use posix relative path * add doc link in dialog * rename book to Jupyter book
This commit is contained in:
@@ -10,10 +10,16 @@ export class TocEntryPathHandler {
|
||||
public readonly fileInTocEntry: string;
|
||||
public readonly titleInTocEntry: string;
|
||||
public readonly fileExtension: FileExtension;
|
||||
|
||||
/**
|
||||
* Creates an object that contains the specific format for title and file entries in a Jupyter Book table of contents
|
||||
* that is compatible on Windows and Mac.
|
||||
*/
|
||||
constructor(public readonly filePath: string, public readonly bookRoot: string, title?: string) {
|
||||
const relativePath = path.relative(bookRoot, filePath);
|
||||
const pathDetails = path.parse(relativePath);
|
||||
this.fileInTocEntry = relativePath.replace(pathDetails.ext, '');
|
||||
//To keep consistency how the file entries are in Jupyter Book toc on Windows and Mac.
|
||||
const tocRelativePath = path.posix.join(path.posix.sep, path.posix.relative(bookRoot, filePath));
|
||||
const pathDetails = path.parse(tocRelativePath);
|
||||
this.fileInTocEntry = tocRelativePath.replace(pathDetails.ext, '');
|
||||
this.titleInTocEntry = title ?? pathDetails.name;
|
||||
this.fileExtension = pathDetails.ext === FileExtension.Notebook ? FileExtension.Notebook : FileExtension.Markdown;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user