diff --git a/apps/server/src/routes/api/other.ts b/apps/server/src/routes/api/other.ts index 0b8d852493..3481c1647b 100644 --- a/apps/server/src/routes/api/other.ts +++ b/apps/server/src/routes/api/other.ts @@ -1,8 +1,8 @@ +import { RenderMarkdownResponse, ToMarkdownResponse } from "@triliumnext/commons"; +import { markdownImportService } from "@triliumnext/core"; import type { Request } from "express"; -import markdownService from "../../services/import/markdown.js"; import markdown from "../../services/export/markdown.js"; -import { RenderMarkdownResponse, ToMarkdownResponse } from "@triliumnext/commons"; function renderMarkdown(req: Request) { const { markdownContent } = req.body; @@ -10,7 +10,7 @@ function renderMarkdown(req: Request) { throw new Error('markdownContent parameter is required and must be a string'); } return { - htmlContent: markdownService.renderToHtml(markdownContent, "") + htmlContent: markdownImportService.renderToHtml(markdownContent, "") } satisfies RenderMarkdownResponse; } diff --git a/packages/trilium-core/src/index.ts b/packages/trilium-core/src/index.ts index c9f01f127b..d1f713884e 100644 --- a/packages/trilium-core/src/index.ts +++ b/packages/trilium-core/src/index.ts @@ -10,6 +10,7 @@ import { initSchema, initDemoArchive } from "./services/sql_init"; import appInfo from "./services/app_info"; import { type PlatformProvider, initPlatform } from "./services/platform"; import { type ZipProvider, initZipProvider } from "./services/import/zip_provider"; +import markdown from "./services/import/markdown"; export { getLog } from "./services/log"; export type * from "./services/sql/types"; @@ -106,6 +107,8 @@ export { default as zipImportService } from "./services/import/zip"; export * as becca_easy_mocking from "./test/becca_easy_mocking"; export * as becca_mocking from "./test/becca_mocking"; +export { default as markdownImportService } from "./services/import/markdown"; + export async function initializeCore({ dbConfig, executionContext, crypto, zip, translations, messaging, request, schema, extraAppInfo, platform, getDemoArchive }: { dbConfig: SqlServiceParams, executionContext: ExecutionContext, diff --git a/packages/trilium-core/src/routes/api/import.ts b/packages/trilium-core/src/routes/api/import.ts index ea78365928..89b3018881 100644 --- a/packages/trilium-core/src/routes/api/import.ts +++ b/packages/trilium-core/src/routes/api/import.ts @@ -1,9 +1,7 @@ import type { Request } from "express"; import type { File } from "../../services/import/common.js"; -interface ImportRequest

extends Request

{ - file?: File; -} +type ImportRequest

= Omit, "file"> & { file?: File }; import becca from "../../becca/becca.js"; import type BNote from "../../becca/entities/bnote.js"; @@ -64,6 +62,7 @@ async function importNotesToBranch(req: ImportRequest<{ parentNoteId: string }>) return importResult; } } else if (extension === ".enex" && options.explodeArchives) { + throw "ENEX import is currently not supported. Please use the desktop app to import ENEX files and then sync with the server."; // const importResult = await enexImportService.importEnex(taskContext, file, parentNote); // if (!Array.isArray(importResult)) { // note = importResult;