You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-12 22:57:38 +02:00
Clipper: Download images and convert them to resources
This commit is contained in:
@ -386,6 +386,29 @@ class BaseApplication {
|
||||
return os.homedir() + '/.config/' + Setting.value('appName');
|
||||
}
|
||||
|
||||
async testing() {
|
||||
const ClipperServer = require('lib/ClipperServer');
|
||||
const server = new ClipperServer();
|
||||
const HtmlToMd = require('lib/HtmlToMd');
|
||||
const service = new HtmlToMd();
|
||||
const html = await shim.fsDriver().readFile('/mnt/d/test.html');
|
||||
let markdown = service.parse(html);
|
||||
console.info(markdown);
|
||||
console.info('--------------------------------------------------');
|
||||
|
||||
const imageUrls = server.extractImageUrls(markdown);
|
||||
let result = await server.downloadImages(imageUrls);
|
||||
result = await server.createResourcesFromPaths(result);
|
||||
console.info(result);
|
||||
markdown = server.replaceImageUrlByResources(markdown, result);
|
||||
console.info('--------------------------------------------------');
|
||||
console.info(markdown);
|
||||
console.info('--------------------------------------------------');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
async start(argv) {
|
||||
let startFlags = await this.handleStartFlags_(argv);
|
||||
|
||||
@ -467,6 +490,8 @@ class BaseApplication {
|
||||
if (!currentFolder) currentFolder = await Folder.defaultFolder();
|
||||
Setting.setValue('activeFolderId', currentFolder ? currentFolder.id : '');
|
||||
|
||||
// await this.testing();process.exit();
|
||||
|
||||
this.clipperServer_ = new ClipperServer();
|
||||
this.clipperServer_.start();
|
||||
|
||||
|
Reference in New Issue
Block a user