Skip to content

Commit

Permalink
fix: Merge pull request #109 from samuele-cozzi/108-html-enhanced-view
Browse files Browse the repository at this point in the history
fix: enable advanced html
  • Loading branch information
samuele-cozzi committed Oct 27, 2023
2 parents 2996491 + a014c7a commit 88a95ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
8 changes: 8 additions & 0 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ const context = await esbuild.context({
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
plugins: [
copy({
assets: {
from: ['node_modules/@marp-team/marp-cli/lib/*'],
to: ['./lib/'],
}
})
],
//outfile: "vault/.obsidian/plugins/marp-slides/main.js", //for local dev!!!
outfile: "main.js",
});
Expand Down
15 changes: 8 additions & 7 deletions src/utilities/filePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class FilePath {
}

private getRootPath(file: TFile): string {

let basePath = (file.vault.adapter as FileSystemAdapter).getBasePath();
if (basePath.startsWith('/')){
basePath = `/${normalizePath(basePath)}`;
Expand All @@ -18,25 +19,25 @@ export class FilePath {
{
basePath = normalizePath(basePath);
}
//console.log(`Root Path: ${basePath}`);
console.log(`Root Path: ${basePath}`);
return basePath;
}

getCompleteFileBasePath(file: TFile): string{
const resourcePath = (file.vault.adapter as FileSystemAdapter).getResourcePath(normalizePath(file.parent.path)).split("?");
//console.log(`Complete File Base Path: ${resourcePath}`);
console.log(`Complete File Base Path: ${resourcePath}`);
return `${resourcePath[0]}/`;
}

getCompleteFilePath(file: TFile) : string{
const basePath = `${this.getRootPath(file)}/${normalizePath(file.path)}`;
//console.log(`Complete File Path: ${basePath}`);
console.log(`Complete File Path: ${basePath}`);
return basePath;
}

getThemePath(file: TFile): string{
const themePath = `${this.getRootPath(file)}/${normalizePath(this.settings.ThemePath)}`;
//console.log(`Theme Path: ${themePath}`);
console.log(`Theme Path: ${themePath}`);
if (this.settings.ThemePath != ''){
return themePath;
}
Expand All @@ -49,14 +50,14 @@ export class FilePath {
private getPluginDirectory(vault: Vault): string {
const fileSystem = vault.adapter as FileSystemAdapter;
const path = normalizePath(`${fileSystem.getBasePath()}/${vault.configDir}/plugins/marp-slides`) + '/';
//console.log(path);
console.log(path);
return path;
}

getLibDirectory(vault: Vault): string {
public getLibDirectory(vault: Vault): string {
const pluginDirectory = this.getPluginDirectory(vault);
const path = normalizePath(`${pluginDirectory}lib`) + '/';
//console.log(path);
console.log(path);
return path;
}
}

0 comments on commit 88a95ae

Please sign in to comment.