Skip to content

Commit

Permalink
Merge pull request #25 from shd101wyy/0.1.9
Browse files Browse the repository at this point in the history
0.1.9
  • Loading branch information
shd101wyy authored Jul 16, 2017
2 parents 92c66f1 + a96063d commit 91b8d1f
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 26 deletions.
25 changes: 25 additions & 0 deletions docs/newest.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@
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 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)
* 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

* Upgraded [mume](https://github.com/shd101wyy/mume) to version `0.1.2`.
Expand Down
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
}
Expand All @@ -316,7 +326,7 @@
"package": "vsce package"
},
"dependencies": {
"@shd101wyy/mume": "^0.1.2"
"@shd101wyy/mume": "^0.1.3"
},
"devDependencies": {
"@types/jquery": "^2.0.46",
Expand All @@ -327,4 +337,4 @@
"typescript": "^2.0.3",
"vscode": "^1.0.0"
}
}
}
29 changes: 9 additions & 20 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string[]>
public readonly mathBlockDelimiters: Array<string[]>

/**
* 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')
Expand All @@ -55,8 +41,8 @@ export class MarkdownPreviewEnhancedConfig implements MarkdownEngineConfig {
this.enableTypographer = config.get<boolean>('enableTypographer')
this.enableWikiLinkSyntax = config.get<boolean>('enableWikiLinkSyntax')
this.wikiLinkFileExtension = config.get<string>('wikiLinkFileExtension')
this.enableExtendedTableSyntax = config.get<boolean>('enableExtendedTableSyntax')
this.frontMatterRenderingOption = config.get<string>('frontMatterRenderingOption')
this.scrollSync = config.get<boolean>('scrollSync')
this.mermaidTheme = config.get<string>('mermaidTheme')
this.mathRenderingOption = config.get<string>('mathRenderingOption')
this.mathInlineDelimiters = config.get<Array<string[]>>('mathInlineDelimiters')
Expand All @@ -72,6 +58,9 @@ export class MarkdownPreviewEnhancedConfig implements MarkdownEngineConfig {
this.pandocPath = config.get<string>('pandocPath')
this.pandocMarkdownFlavor = config.get<string>('pandocMarkdownFlavor')
this.pandocArguments = config.get<string>('pandocArguments').split(',').map((x)=> x.trim())
this.latexEngine = config.get<string>('latexEngine')

this.scrollSync = config.get<boolean>('scrollSync')
}

public isEqualTo(otherConfig: MarkdownPreviewEnhancedConfig) {
Expand Down
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion src/preview-content-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 91b8d1f

Please sign in to comment.