You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
23 lines
569 B
TypeScript
23 lines
569 B
TypeScript
import HtmlToMd from '../HtmlToMd';
|
|
import { CommandContext, CommandRuntime, CommandDeclaration } from '../services/CommandService';
|
|
|
|
export const declaration: CommandDeclaration = {
|
|
name: 'convertHtmlToMarkdown',
|
|
};
|
|
|
|
export const runtime = (): CommandRuntime => {
|
|
return {
|
|
execute: async (_context: CommandContext, html: string) => {
|
|
const htmlToMdParser = new HtmlToMd();
|
|
|
|
const markdown = await htmlToMdParser.parse(`<div>${html}</div>`, {
|
|
baseUrl: '',
|
|
anchorNames: [],
|
|
convertEmbeddedPdfsToLinks: true,
|
|
});
|
|
|
|
return markdown;
|
|
},
|
|
};
|
|
};
|