Skip to content

Commit 12ba899

Browse files
authored
feat: export sasnb to HTML (#1417)
1 parent 1c5e0dd commit 12ba899

File tree

14 files changed

+750
-39
lines changed

14 files changed

+750
-39
lines changed

client/package-lock.json

Lines changed: 215 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"ag-grid-community": "^33.1.1",
1313
"ag-grid-react": "^33.1.1",
1414
"axios": "^1.8.2",
15+
"highlight.js": "^11.11.1",
16+
"marked": "^15.0.7",
1517
"media-typer": "^1.1.0",
1618
"react": "^18.3.1",
1719
"react-dom": "^18.3.1",
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
import { Uri, window, workspace } from "vscode";
4+
import type { LanguageClient } from "vscode-languageclient/node";
5+
6+
import path from "path";
7+
8+
import { exportToHTML } from "./toHTML";
9+
import { exportToSAS } from "./toSAS";
10+
11+
export const exportNotebook = async (client: LanguageClient) => {
12+
const notebook = window.activeNotebookEditor?.notebook;
13+
14+
if (!notebook) {
15+
return;
16+
}
17+
18+
const uri = await window.showSaveDialog({
19+
filters: { SAS: ["sas"], HTML: ["html"] },
20+
defaultUri: Uri.parse(path.basename(notebook.uri.path, ".sasnb")),
21+
});
22+
23+
if (!uri) {
24+
return;
25+
}
26+
27+
const content = uri.path.endsWith(".html")
28+
? await exportToHTML(notebook, client)
29+
: exportToSAS(notebook);
30+
31+
workspace.fs.writeFile(uri, Buffer.from(content));
32+
};

0 commit comments

Comments
 (0)