Add isomorphic basename utility

This commit is contained in:
Philipinho
2026-01-25 00:08:02 +00:00
parent 5588ec34fb
commit 5dbf0027bd
2 changed files with 31 additions and 1 deletions
@@ -1,5 +1,6 @@
import * as _TurndownService from '@joplin/turndown';
import * as TurndownPluginGfm from '@joplin/turndown-plugin-gfm';
import { getBasename } from './basename';
// CJS/ESM interop: .default exists in Vite, not in NestJS
const TurndownService = (_TurndownService as any).default || _TurndownService;
@@ -160,7 +161,7 @@ function video(turndownService: _TurndownService) {
},
replacement: function (_content: string, node: HTMLInputElement) {
const src = node.getAttribute('src') || '';
const name = src.split('/').pop() || src;
const name = getBasename(src) || src;
return '[' + name + '](' + src + ')';
},
});