diff --git a/.github/workflows/lint-and-build.yml b/.github/workflows/lint-and-build.yml index c9932a0..0602e46 100644 --- a/.github/workflows/lint-and-build.yml +++ b/.github/workflows/lint-and-build.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - nodejs: [12, 14] + nodejs: [18, 20] steps: - uses: actions/checkout@v2 diff --git a/src/renderer.ts b/src/renderer.ts index 9119edb..ba14349 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -3,7 +3,9 @@ import { MarkdownRenderer, MarkdownView } from 'obsidian'; import MarkdownExportPlugin from "./main"; export default async function markdownToHTML(plugin: MarkdownExportPlugin, inputFile: string, inputContent: string) { + // @ts-ignore let activeView = app.workspace.getActiveViewOfType(MarkdownView); + // @ts-ignore const leaf = app.workspace.getLeaf(true); if (!activeView) { activeView = new MarkdownView(leaf); diff --git a/src/utils.ts b/src/utils.ts index 8895af2..918e61a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -344,11 +344,6 @@ export async function tryCopyMarkdownByRead( for (const index in imageLinks) { const rawImageLink = imageLinks[index][0]; - const { width, height } = imageLinks[index].groups as { - width: string | null; - height: string | null; - }; - const urlEncodedImageLink = imageLinks[index][7 - imageLinks[index].length]; @@ -385,6 +380,7 @@ export async function tryCopyMarkdownByRead( } if (plugin.settings.displayImageAsHtml) { + const { width = null, height = null } = imageLinks[index]?.groups || {}; const style = width && height ? ` style='width: {${width}}px; height: ${height}px;'`