diff --git a/README.md b/README.md index 4e31e50..2fdaba1 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ Then choose from the list what document type you want to render and press `enter ## **Setting additional pandoc options** -1. choose 'Preference -> UserSettings' -1. Find: pandoc in Default Settings -1. Copy and paste -1. to settings.json +1. Choose 'File -> Preference -> Settings' +2. Open `settings.json` (button with three dots in the top right corner on the Settings screen) +3. Find `pandoc` in Default User Settings +4. Copy and paste to `settings.json` -example: +Example: ```json //-------- Pandoc Option Configuration -------- diff --git a/src/extension.ts b/src/extension.ts index a26423a..c8accea 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -12,18 +12,33 @@ function setStatusBarText(what, docType){ function getPandocOptions(quickPickLabel) { var pandocOptions; - + var pandocConfiguration = vscode.workspace.getConfiguration('pandoc'); switch (quickPickLabel) { case 'pdf': - pandocOptions = vscode.workspace.getConfiguration('pandoc').get('pdfOptString'); + if (pandocConfiguration.has('pdfOptString')) { + pandocOptions = pandocConfiguration.get('pdfOptString'); + } + else { + pandocOptions = ''; + } console.log('pdocOptstring = ' + pandocOptions); break; case 'docx': - pandocOptions = vscode.workspace.getConfiguration('pandoc').get('docxOptString'); + if (pandocConfiguration.has('docxOptString')) { + pandocOptions = pandocConfiguration.get('docxOptString'); + } + else { + pandocOptions = ''; + } console.log('pdocOptstring = ' + pandocOptions); break; case 'html': - pandocOptions = vscode.workspace.getConfiguration('pandoc').get('htmlOptString'); + if (pandocConfiguration.has('htmlOptString')) { + pandocOptions = pandocConfiguration.get('htmlOptString'); + } + else { + pandocOptions = ''; + } console.log('pdocOptstring = ' + pandocOptions); break; } @@ -59,6 +74,9 @@ export function activate(context: vscode.ExtensionContext) { setStatusBarText('Generating', qpSelection.label); var pandocOptions = getPandocOptions(qpSelection.label); + + if (pandocOptions === undefined) + pandocOptions = '' // debug console.log('debug: outFile = ' + inFile);