Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 257 additions & 5 deletions bun.lock

Large diffs are not rendered by default.

1,342 changes: 1,254 additions & 88 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,15 @@
"filesize": "^11.0.13",
"html-tag-js": "^2.4.16",
"jszip": "^3.10.1",
"katex": "^0.16.39",
"markdown-it": "^14.1.1",
"markdown-it-anchor": "^9.2.0",
"markdown-it-emoji": "^3.0.0",
"markdown-it-footnote": "^4.0.0",
"markdown-it-github-alerts": "^1.0.0",
"markdown-it-task-lists": "^2.1.1",
"markdown-it-texmath": "^1.0.0",
"mermaid": "^11.13.0",
"mime-types": "^3.0.1",
"mustache": "^4.2.0",
"picomatch": "^4.0.3",
Expand Down
12 changes: 10 additions & 2 deletions src/lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import anchor from "markdown-it-anchor";
import MarkdownItGitHubAlerts from "markdown-it-github-alerts";
import mimeType from "mime-types";
import mustache from "mustache";
import openMarkdownPreview from "pages/markdownPreview";
import browser from "plugins/browser";
import helpers from "utils/helpers";
import Url from "utils/Url";
Expand All @@ -31,6 +32,15 @@ async function run(
target = appSettings.value.previewMode,
runFile = false,
) {
/** @type {EditorFile} */
const activeFile = isConsole ? null : editorManager.activeFile;

if (!isConsole && Url.extname(activeFile?.filename || "") === ".md") {
if (!(await activeFile?.canRun())) return;
await openMarkdownPreview(activeFile);
return;
}

if (!isConsole && !runFile) {
const { serverPort, previewPort, previewMode, disableCache, host } =
appSettings.value;
Expand All @@ -46,8 +56,6 @@ async function run(
}
}

/** @type {EditorFile} */
const activeFile = isConsole ? null : editorManager.activeFile;
if (!isConsole && !(await activeFile?.canRun())) return;

if (!isConsole && !localStorage.__init_runPreview) {
Expand Down
Loading