Show resolved Python path in settings (ENG-645)

This commit is contained in:
Ethan Troy 2026-03-17 20:34:35 -04:00
parent a93ed8341d
commit 3a245385cc
3 changed files with 26 additions and 3 deletions

11
main.ts
View file

@ -31,7 +31,12 @@ export default class MarkitdownPlugin extends Plugin {
markitdownVersion: null,
};
converter: MarkitdownConverter = new MarkitdownConverter('python', '.');
private resolvedPythonPath = 'python';
private _resolvedPythonPath = 'python';
/** The Python path actually used after discovery/fallback resolution. */
get resolvedPythonPath(): string {
return this._resolvedPythonPath;
}
async onload() {
await this.loadSettings();
@ -40,7 +45,7 @@ export default class MarkitdownPlugin extends Plugin {
const depCheck = await checkDependencies(this.settings.pythonPath, pluginDir);
this.dependencyStatus = depCheck.status;
// Use the resolved python path (handles python→python3 fallback)
this.resolvedPythonPath = depCheck.resolvedPythonPath;
this._resolvedPythonPath = depCheck.resolvedPythonPath;
this.converter = new MarkitdownConverter(this.resolvedPythonPath, pluginDir);
// Ribbon icon
@ -232,7 +237,7 @@ export default class MarkitdownPlugin extends Plugin {
const pluginDir = this.getPluginDir();
const depCheck = await checkDependencies(this.settings.pythonPath, pluginDir);
this.dependencyStatus = depCheck.status;
this.resolvedPythonPath = depCheck.resolvedPythonPath;
this._resolvedPythonPath = depCheck.resolvedPythonPath;
this.converter = new MarkitdownConverter(this.resolvedPythonPath, pluginDir);
}

View file

@ -60,6 +60,14 @@ export class SettingsTab extends PluginSettingTab {
}, 1500);
}));
// Show the resolved Python path when it differs from the configured path
const configuredPath = this.plugin.settings.pythonPath || 'python';
const resolvedPath = this.plugin.resolvedPythonPath;
if (resolvedPath && resolvedPath !== configuredPath) {
const hint = containerEl.createDiv('markitdown-resolved-path-hint');
hint.setText(`Resolved: ${resolvedPath}`);
}
// ── Conversion ──────────────────────────
new Setting(containerEl)
.setName('Conversion')

View file

@ -66,6 +66,16 @@ Styles for the Markitdown Obsidian plugin
color: var(--text-error);
}
/* Resolved Python path hint */
.markitdown-resolved-path-hint {
font-size: 0.85em;
color: var(--text-muted);
margin-top: -8px;
margin-bottom: 12px;
padding-left: 2px;
font-family: var(--font-monospace);
}
/* File type checkbox grid */
.markitdown-checkbox-grid {
display: grid;