From 9061d204c95b08a3db09e1f326bf718a5c5e1512 Mon Sep 17 00:00:00 2001 From: Yiyi Wang Date: Sat, 15 Jul 2017 22:48:33 -0500 Subject: [PATCH 1/3] Fixed HTML export bug. Added `latexEngine` and `enableExtendedTableSyntax` config options. --- docs/newest.md | 10 ++++++++++ package.json | 14 ++++++++++++-- src/config.ts | 29 +++++++++-------------------- src/extension.ts | 6 +++--- src/preview-content-provider.ts | 2 +- 5 files changed, 35 insertions(+), 26 deletions(-) diff --git a/docs/newest.md b/docs/newest.md index 9b9711b..80f81ee 100644 --- a/docs/newest.md +++ b/docs/newest.md @@ -2,6 +2,16 @@ I think I have finished porting [Markdown Preview Enhanced for Atom](https://atom.io/packages/markdown-preview-enhanced) successfully to VS Code. Cheers :) +## 0.1.9 +* Upgraded [mume](https://github.com/shd101wyy/mume) to version `0.1.3`. + * Fixed pandoc export bug. + * Fixed markdown export bug. Added `ignore_from_front_matter` option in `markdown` field. Removed `front_matter` option from `markdown` field. + * Added `latexEngine` and `enableExtendedTableSyntax` config options. Now supporting merging table cells (disabled by default. Could be enabled from settings). + [#479](https://github.com/shd101wyy/markdown-preview-enhanced/issues/479), [#133](https://github.com/shd101wyy/markdown-preview-enhanced/issues/133). + + ![screen shot 2017-07-15 at 8 16 45 pm](https://user-images.githubusercontent.com/1908863/28243710-945e3004-699a-11e7-9a5f-d74f6c944c3b.png) +* Fixed html export bug. + ## 0.1.8 * Upgraded [mume](https://github.com/shd101wyy/mume) to version `0.1.2`. diff --git a/package.json b/package.json index 9bfa90d..ce2694e 100644 --- a/package.json +++ b/package.json @@ -185,6 +185,11 @@ "default": ".md", "type": "string" }, + "markdown-preview-enhanced.enableExtendedTableSyntax": { + "description": "Enable extended table syntax to support merging table cells.", + "default": false, + "type": "boolean" + }, "markdown-preview-enhanced.frontMatterRenderingOption": { "description": "Front matter rendering option", "type": "string", @@ -304,6 +309,11 @@ "description": "Comma separated pandoc arguments e.g. `--smart, --filter=/bin/exe`. Please use long argument names.", "default": "", "type": "string" + }, + "markdown-preview-enhanced.latexEngine": { + "description": "Default latex engine for Pandoc export and latex code chunk.", + "default": "pdflatex", + "type": "string" } } } @@ -316,7 +326,7 @@ "package": "vsce package" }, "dependencies": { - "@shd101wyy/mume": "^0.1.2" + "@shd101wyy/mume": "file:..\\..\\Documents\\GitHub\\mume" }, "devDependencies": { "@types/jquery": "^2.0.46", @@ -327,4 +337,4 @@ "typescript": "^2.0.3", "vscode": "^1.0.0" } -} \ No newline at end of file +} diff --git a/src/config.ts b/src/config.ts index c83883a..ac2c367 100644 --- a/src/config.ts +++ b/src/config.ts @@ -11,41 +11,27 @@ export class MarkdownPreviewEnhancedConfig implements MarkdownEngineConfig { public readonly enableTypographer: boolean public readonly enableWikiLinkSyntax: boolean public readonly wikiLinkFileExtension: string + public readonly enableExtendedTableSyntax: boolean public readonly frontMatterRenderingOption:string - public readonly scrollSync: boolean - /** - * "KaTeX", "MathJax", or "None" - */ public readonly mathRenderingOption: string public readonly mathInlineDelimiters: Array public readonly mathBlockDelimiters: Array - - /** - * Themes - */ public readonly codeBlockTheme: string public readonly mermaidTheme: string public readonly previewTheme: string public readonly revealjsTheme: string - public readonly protocolsWhiteList: string - - /** - * image helper - */ public readonly imageFolderPath: string public readonly imageUploader: string - public readonly printBackground: boolean - public readonly phantomPath: string - - /** - * pandoc - */ public readonly pandocPath: string public readonly pandocMarkdownFlavor: string public readonly pandocArguments: string[] + public readonly latexEngine: string + + // preview config + public readonly scrollSync: boolean private constructor() { const config = vscode.workspace.getConfiguration('markdown-preview-enhanced') @@ -55,8 +41,8 @@ export class MarkdownPreviewEnhancedConfig implements MarkdownEngineConfig { this.enableTypographer = config.get('enableTypographer') this.enableWikiLinkSyntax = config.get('enableWikiLinkSyntax') this.wikiLinkFileExtension = config.get('wikiLinkFileExtension') + this.enableExtendedTableSyntax = config.get('enableExtendedTableSyntax') this.frontMatterRenderingOption = config.get('frontMatterRenderingOption') - this.scrollSync = config.get('scrollSync') this.mermaidTheme = config.get('mermaidTheme') this.mathRenderingOption = config.get('mathRenderingOption') this.mathInlineDelimiters = config.get>('mathInlineDelimiters') @@ -72,6 +58,9 @@ export class MarkdownPreviewEnhancedConfig implements MarkdownEngineConfig { this.pandocPath = config.get('pandocPath') this.pandocMarkdownFlavor = config.get('pandocMarkdownFlavor') this.pandocArguments = config.get('pandocArguments').split(',').map((x)=> x.trim()) + this.latexEngine = config.get('latexEngine') + + this.scrollSync = config.get('scrollSync') } public isEqualTo(otherConfig: MarkdownPreviewEnhancedConfig) { diff --git a/src/extension.ts b/src/extension.ts index 24627e2..4612eee 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -169,9 +169,9 @@ export function activate(context: vscode.ExtensionContext) { contentProvider.openInBrowser(sourceUri) } - function saveAsHTML(uri, offline) { + function htmlExport(uri, offline) { const sourceUri = vscode.Uri.parse(decodeURIComponent(uri)); - contentProvider.saveAsHTML(sourceUri, offline) + contentProvider.htmlExport(sourceUri, offline) } function phantomjsExport(uri, type) { @@ -406,7 +406,7 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(vscode.commands.registerCommand('_mume.openInBrowser', openInBrowser)) - context.subscriptions.push(vscode.commands.registerCommand('_mume.saveAsHTML', saveAsHTML)) + context.subscriptions.push(vscode.commands.registerCommand('_mume.htmlExport', htmlExport)) context.subscriptions.push(vscode.commands.registerCommand('_mume.phantomjsExport', phantomjsExport)) diff --git a/src/preview-content-provider.ts b/src/preview-content-provider.ts index e201c15..ad6ae46 100644 --- a/src/preview-content-provider.ts +++ b/src/preview-content-provider.ts @@ -302,7 +302,7 @@ export class MarkdownPreviewEnhancedView implements vscode.TextDocumentContentPr } } - public saveAsHTML(sourceUri: Uri, offline:boolean) { + public htmlExport(sourceUri: Uri, offline:boolean) { const engine = this.getEngine(sourceUri) if (engine) { engine.htmlExport({offline}) From a1d9e62e4762a975a8c53ea82d64044a7c9870ca Mon Sep 17 00:00:00 2001 From: Yiyi Wang Date: Sun, 16 Jul 2017 00:30:07 -0500 Subject: [PATCH 2/3] Done testing on Windows. --- docs/newest.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/newest.md b/docs/newest.md index 80f81ee..87a77b4 100644 --- a/docs/newest.md +++ b/docs/newest.md @@ -4,13 +4,28 @@ I think I have finished porting [Markdown Preview Enhanced for Atom](https://ato ## 0.1.9 * Upgraded [mume](https://github.com/shd101wyy/mume) to version `0.1.3`. - * Fixed pandoc export bug. + * Fixed pandoc export bug on Windows. * Fixed markdown export bug. Added `ignore_from_front_matter` option in `markdown` field. Removed `front_matter` option from `markdown` field. * Added `latexEngine` and `enableExtendedTableSyntax` config options. Now supporting merging table cells (disabled by default. Could be enabled from settings). [#479](https://github.com/shd101wyy/markdown-preview-enhanced/issues/479), [#133](https://github.com/shd101wyy/markdown-preview-enhanced/issues/133). ![screen shot 2017-07-15 at 8 16 45 pm](https://user-images.githubusercontent.com/1908863/28243710-945e3004-699a-11e7-9a5f-d74f6c944c3b.png) -* Fixed html export bug. + * Supported `export_on_save` front-matter that exports files when you save your markdown file. However, `phantomjs`, `prince`, `pandoc`, `ebook` are not recommended for `export_on_save` because it's too slow. + + eg: + ```javascript + --- + export_on_save: + html: true + markdown: true + prince: true + phantomjs: true // or "pdf" | "jpeg" | "png" | ["pdf", ...] + pandoc: true + ebook: true // or "epub" | "mobi" | "html" | "pdf" | array + --- + ``` + * Added `embed_svg` front-matter option for HTML export, which is enabled by default. +* Fixed html export bug. ## 0.1.8 From a96063d37916f56e43622859020ee51defb0ad7f Mon Sep 17 00:00:00 2001 From: Yiyi Wang Date: Sun, 16 Jul 2017 00:48:03 -0500 Subject: [PATCH 3/3] Done version 0.1.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce2694e..9d3be12 100644 --- a/package.json +++ b/package.json @@ -326,7 +326,7 @@ "package": "vsce package" }, "dependencies": { - "@shd101wyy/mume": "file:..\\..\\Documents\\GitHub\\mume" + "@shd101wyy/mume": "^0.1.3" }, "devDependencies": { "@types/jquery": "^2.0.46",