Skip to content

Commit

Permalink
HTML save bug
Browse files Browse the repository at this point in the history
  • Loading branch information
goessner committed Jun 15, 2020
1 parent cc76ae8 commit 0944adc
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
img
.github
.gitignore
5 changes: 2 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ exports.activate = function activate(context) {
save = (arg) => {
try {
const doc = arg && arg.uri ? arg : vscode.window.activeTextEditor && vscode.window.activeTextEditor.document;
const uri = vscode.window.activeTextEditor.document.uri;
if (!doc)
errMsg('Saving html failed: invalid editor document!');
else if (doc.languageId !== 'markdown')
errMsg('Saving html failed: Active document is no markdown source document!');
else if (doc.isUntitled)
errMsg('Saving html failed: current untitled markdown document needs to be saved once first!');
else {
fs.writeFileSync(outputLocationOf(uri), asHTML(doc), 'utf8');
infoMsg(`Html saved to ${outputLocationOf(uri)} !`);
fs.writeFileSync(outputLocationOf(doc.uri), asHTML(doc), 'utf8');
infoMsg(`Html saved to ${outputLocationOf(doc.uri)} !`);
}
} catch (err) {
errMsg('Saving html failed: ' + err.message);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Markdown+Math",
"description": "LaTeX Math for Markdown ... with macros and more",
"icon": "img/icon.png",
"version": "2.5.0",
"version": "2.5.1",
"author": "Stefan Goessner",
"publisher": "goessner",
"keywords": [
Expand Down
Loading

0 comments on commit 0944adc

Please sign in to comment.